Autogenerated HTML docs for v1.6.2.2-446-gfbdc 
diff --git a/config.txt b/config.txt index ad22cb8..3afd124 100644 --- a/config.txt +++ b/config.txt 
@@ -480,7 +480,7 @@  branch.<name>.merge:: 	Defines, together with branch.<name>.remote, the upstream branch 	for the given branch. It tells 'git-fetch'/'git-pull' which -	branch to merge from. +	branch to merge and can also affect 'git-push' (see push.default). 	When in branch <name>, it tells 'git-fetch' the default 	refspec to be marked for merging in FETCH_HEAD. The value is 	handled like the remote part of a refspec, and must match a @@ -715,6 +715,13 @@ 	A true boolean value is the same as `shallow`, and a false 	value disables threading.   +format.signoff:: + A boolean value which lets you enable the `-s/--signoff` option of + format-patch by default. *Note:* Adding the Signed-off-by: line to a + patch should be a conscious act and means that you certify you have + the rights to submit this work under the same open source license. + Please see the 'SubmittingPatches' document for further discussion. +  gc.aggressiveWindow:: 	The window size parameter used in the delta compression 	algorithm used by 'git-gc --aggressive'. This defaults 
diff --git a/docbook-xsl.css b/docbook-xsl.css index b878b38..e11c8f0 100644 --- a/docbook-xsl.css +++ b/docbook-xsl.css 
@@ -16,6 +16,7 @@  html body {  margin: 1em 5% 1em 5%;  line-height: 1.2; + font-family: sans-serif;  }    body div { @@ -128,6 +129,15 @@    tt.literal, code.literal {  color: navy; + font-family: sans-serif; +} + +code.literal:before { content: "'"; } +code.literal:after { content: "'"; } + +em { + font-style: italic; + color: #064;  }    div.literallayout p { @@ -137,7 +147,6 @@    div.literallayout {  font-family: monospace; -# margin: 0.5em 10% 0.5em 1em;  margin: 0em;  color: navy;  border: 1px solid silver; @@ -187,7 +196,8 @@  }    dt span.term { - font-style: italic; + font-style: normal; + color: navy;  }    div.variablelist dd p { 
diff --git a/git-check-ref-format.html b/git-check-ref-format.html index adab473..824d5e2 100644 --- a/git-check-ref-format.html +++ b/git-check-ref-format.html 
@@ -320,7 +320,9 @@  </div>   <h2>SYNOPSIS</h2>   <div class="sectionbody">  -<div class="para"><p><em>git check-ref-format</em> &lt;refname&gt;</p></div>  +<div class="verseblock">  +<div class="content"><em>git check-ref-format</em> &lt;refname&gt;  +<em>git check-ref-format</em> [--branch] &lt;branchname-shorthand&gt;</div></div>   </div>   <h2 id="_description">DESCRIPTION</h2>   <div class="sectionbody">  @@ -353,7 +355,17 @@  </li>   <li>   <p>  -They cannot end with a slash <tt>/</tt>.  +They cannot end with a slash <tt>/</tt> nor a dot <tt>.</tt>.  +</p>  +</li>  +<li>  +<p>  +They cannot end with the sequence <tt>.lock</tt>.  +</p>  +</li>  +<li>  +<p>  +They cannot contain a sequence <tt>@{</tt>.   </p>   </li>   </ol></div>  @@ -383,7 +395,27 @@  'git-cat-file': "git cat-file blob v1.3.3:refs.c".   </p>   </li>  +<li>  +<p>  +at-open-brace <tt>@{</tt> is used as a notation to access a reflog entry.  +</p>  +</li>   </ol></div>  +<div class="para"><p>With the <tt>--branch</tt> option, it expands a branch name shorthand and  +prints the name of the branch the shorthand refers to.</p></div>  +</div>  +<h2 id="_example">EXAMPLE</h2>  +<div class="sectionbody">  +<div class="vlist"><dl>  +<dt>  +git check-ref-format --branch @{-1}  +</dt>  +<dd>  +<p>  +Print the name of the previous branch.  +</p>  +</dd>  +</dl></div>   </div>   <h2 id="_git">GIT</h2>   <div class="sectionbody">  @@ -391,7 +423,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:49:46 UTC  +Last updated 2009-04-06 08:26:29 UTC   </div>   </div>   </body>  
diff --git a/git-check-ref-format.txt b/git-check-ref-format.txt index 171b683..c1ce268 100644 --- a/git-check-ref-format.txt +++ b/git-check-ref-format.txt 
@@ -7,7 +7,9 @@    SYNOPSIS  -------- +[verse]  'git check-ref-format' <refname> +'git check-ref-format' [--branch] <branchname-shorthand>    DESCRIPTION  ----------- @@ -30,7 +32,11 @@  caret `{caret}`, colon `:`, question-mark `?`, asterisk `*`,  or open bracket `[` anywhere.   -. They cannot end with a slash `/`. +. They cannot end with a slash `/` nor a dot `.`. + +. They cannot end with the sequence `.lock`. + +. They cannot contain a sequence `@{`.    These rules make it easy for shell script based tools to parse  reference names, pathname expansion by the shell when a reference name is used @@ -49,6 +55,18 @@  It may also be used to select a specific object such as with  'git-cat-file': "git cat-file blob v1.3.3:refs.c".   +. at-open-brace `@{` is used as a notation to access a reflog entry. + +With the `--branch` option, it expands a branch name shorthand and +prints the name of the branch the shorthand refers to. + +EXAMPLE +------- + +git check-ref-format --branch @{-1}:: + +Print the name of the previous branch. +    GIT  --- 
diff --git a/git-config.html b/git-config.html index 521b671..797578f 100644 --- a/git-config.html +++ b/git-config.html 
@@ -1405,7 +1405,7 @@  <p>   Defines, together with branch.&lt;name&gt;.remote, the upstream branch   for the given branch. It tells <em>git-fetch</em>/<em>git-pull</em> which  - branch to merge from.  + branch to merge and can also affect <em>git-push</em> (see push.default).   When in branch &lt;name&gt;, it tells <em>git-fetch</em> the default   refspec to be marked for merging in FETCH_HEAD. The value is   handled like the remote part of a refspec, and must match a  @@ -1833,6 +1833,18 @@  </p>   </dd>   <dt>  +format.signoff  +</dt>  +<dd>  +<p>  + A boolean value which lets you enable the <tt>-s/--signoff</tt> option of  + format-patch by default. <strong>Note:</strong> Adding the Signed-off-by: line to a  + patch should be a conscious act and means that you certify you have  + the rights to submit this work under the same open source license.  + Please see the <em>SubmittingPatches</em> document for further discussion.  +</p>  +</dd>  +<dt>   gc.aggressiveWindow   </dt>   <dd>  @@ -3207,7 +3219,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:49:47 UTC  +Last updated 2009-04-06 08:26:29 UTC   </div>   </div>   </body>  
diff --git a/git-diff-tree.html b/git-diff-tree.html index 7b7d9f3..eb6c7da 100644 --- a/git-diff-tree.html +++ b/git-diff-tree.html 
@@ -1301,6 +1301,11 @@  </li>   <li>   <p>  +<em>%f</em>: sanitized subject line, suitable for a filename  +</p>  +</li>  +<li>  +<p>   <em>%b</em>: body   </p>   </li>  @@ -1964,7 +1969,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:49:50 UTC  +Last updated 2009-04-06 08:26:29 UTC   </div>   </div>   </body>  
diff --git a/git-format-patch.html b/git-format-patch.html index 0ca29f7..3d748af 100644 --- a/git-format-patch.html +++ b/git-format-patch.html 
@@ -1121,7 +1121,8 @@  suffix = .txt   numbered = auto   cc = &lt;email&gt;  - attach [ = mime-boundary-string ]</tt></pre>  + attach [ = mime-boundary-string ]  + signoff = true</tt></pre>   </div></div>   </div>   <h2 id="_examples">EXAMPLES</h2>  @@ -1202,7 +1203,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:49:52 UTC  +Last updated 2009-04-06 08:26:30 UTC   </div>   </div>   </body>  
diff --git a/git-format-patch.txt b/git-format-patch.txt index db3bdb5..eb2fbcf 100644 --- a/git-format-patch.txt +++ b/git-format-patch.txt 
@@ -205,6 +205,7 @@ 	numbered = auto 	cc = <email> 	attach [ = mime-boundary-string ] +	signoff = true  ------------     
diff --git a/git-log.html b/git-log.html index 5369f95..d785e0a 100644 --- a/git-log.html +++ b/git-log.html 
@@ -2003,6 +2003,11 @@  </li>   <li>   <p>  +<em>%f</em>: sanitized subject line, suitable for a filename  +</p>  +</li>  +<li>  +<p>   <em>%b</em>: body   </p>   </li>  @@ -2409,7 +2414,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:49:55 UTC  +Last updated 2009-04-06 08:26:30 UTC   </div>   </div>   </body>  
diff --git a/git-rev-list.html b/git-rev-list.html index 8b51382..e018fa4 100644 --- a/git-rev-list.html +++ b/git-rev-list.html 
@@ -1563,6 +1563,11 @@  </li>   <li>   <p>  +<em>%f</em>: sanitized subject line, suitable for a filename  +</p>  +</li>  +<li>  +<p>   <em>%b</em>: body   </p>   </li>  @@ -1657,7 +1662,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:50:02 UTC  +Last updated 2009-04-06 08:26:31 UTC   </div>   </div>   </body>  
diff --git a/git-show.html b/git-show.html index 433575c..67627bd 100644 --- a/git-show.html +++ b/git-show.html 
@@ -679,6 +679,11 @@  </li>   <li>   <p>  +<em>%f</em>: sanitized subject line, suitable for a filename  +</p>  +</li>  +<li>  +<p>   <em>%b</em>: body   </p>   </li>  @@ -890,7 +895,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:50:04 UTC  +Last updated 2009-04-06 08:26:31 UTC   </div>   </div>   </body>  
diff --git a/git-whatchanged.html b/git-whatchanged.html index e4e06c9..5648664 100644 --- a/git-whatchanged.html +++ b/git-whatchanged.html 
@@ -711,6 +711,11 @@  </li>   <li>   <p>  +<em>%f</em>: sanitized subject line, suitable for a filename  +</p>  +</li>  +<li>  +<p>   <em>%b</em>: body   </p>   </li>  @@ -829,7 +834,7 @@  </div>   <div id="footer">   <div id="footer-text">  -Last updated 2009-04-02 06:50:08 UTC  +Last updated 2009-04-06 08:26:32 UTC   </div>   </div>   </body>  
diff --git a/pretty-formats.txt b/pretty-formats.txt index 5c6e678..2a845b1 100644 --- a/pretty-formats.txt +++ b/pretty-formats.txt 
@@ -121,6 +121,7 @@  - '%d': ref names, like the --decorate option of linkgit:git-log[1]  - '%e': encoding  - '%s': subject +- '%f': sanitized subject line, suitable for a filename  - '%b': body  - '%Cred': switch color to red  - '%Cgreen': switch color to green 
diff --git a/user-manual.html b/user-manual.html index 70dc25f..7409c58 100644 --- a/user-manual.html +++ b/user-manual.html 
@@ -1,4 +1,4 @@ -<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Git User's Manual (for version 1.5.3 or newer)</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id301293"></a>Git User's Manual (for version 1.5.3 or newer)</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id379378">Preface</a></span></dt><dt><span class="chapter"><a href="#repositories-and-branches">1. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#examining-remote-branches">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-With-git-fetch">Updating a repository with git-fetch</a></span></dt><dt><span class="section"><a href="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#exploring-git-history">2. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#using-bisect">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#naming-commits">Naming commits</a></span></dt><dt><span class="section"><a href="#creating-tags">Creating tags</a></span></dt><dt><span class="section"><a href="#browsing-revisions">Browsing revisions</a></span></dt><dt><span class="section"><a href="#generating-diffs">Generating diffs</a></span></dt><dt><span class="section"><a href="#viewing-old-file-versions">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#history-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#counting-commits-on-a-branch">Counting the number of commits on a branch</a></span></dt><dt><span class="section"><a href="#checking-for-equal-branches">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#finding-tagged-descendants">Find first tagged version including a given fix</a></span></dt><dt><span class="section"><a href="#showing-commits-unique-to-a-branch">Showing commits unique to a given branch</a></span></dt><dt><span class="section"><a href="#making-a-release">Creating a changelog and tarball for a software release</a></span></dt><dt><span class="section"><a href="#Finding-comments-With-given-Content">Finding commits referencing a file with given content</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Developing-With-git">3. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#conflict-resolution">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-rewriting-history">Fixing a mistake by rewriting history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sharing-development">4. Sharing development with others</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-updates-With-git-pull">Getting updates with git-pull</a></span></dt><dt><span class="section"><a href="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#forcing-push">What to do when a push fails</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">5. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#rewriting-one-commit">Rewriting a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-With-rewriting-history">Problems with rewriting history</a></span></dt><dt><span class="section"><a href="#bisect-merges">Why bisecting merge commits can be harder than bisecting linear history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#advanced-branch-management">6. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git-fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-concepts">7. Git concepts</a></span></dt><dd><dl><dt><span class="section"><a href="#the-object-database">The Object Database</a></span></dt><dd><dl><dt><span class="section"><a href="#commit-object">Commit Object</a></span></dt><dt><span class="section"><a href="#tree-object">Tree Object</a></span></dt><dt><span class="section"><a href="#blob-object">Blob Object</a></span></dt><dt><span class="section"><a href="#trust">Trust</a></span></dt><dt><span class="section"><a href="#tag-object">Tag Object</a></span></dt><dt><span class="section"><a href="#pack-files">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt><dt><span class="section"><a href="#recovering-from-repository-corruption">Recovering from repository corruption</a></span></dt></dl></dd><dt><span class="section"><a href="#the-index">The index</a></span></dt></dl></dd><dt><span class="chapter"><a href="#submodules">8. Submodules</a></span></dt><dd><dl><dt><span class="section"><a href="#_pitfalls_with_submodules">Pitfalls with submodules</a></span></dt></dl></dd><dt><span class="chapter"><a href="#low-level-operations">9. Low-level git operations</a></span></dt><dd><dl><dt><span class="section"><a href="#object-manipulation">Object access and manipulation</a></span></dt><dt><span class="section"><a href="#the-workflow">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#working-directory-to-index">working directory -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-object-database">index -&gt; object database</a></span></dt><dt><span class="section"><a href="#object-database-to-index">object database -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-working-directory">index -&gt; working directory</a></span></dt><dt><span class="section"><a href="#tying-it-all-together">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#examining-the-data">Examining the data</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees-2">Merging multiple trees, continued</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hacking-git">10. Hacking git</a></span></dt><dd><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">11. GIT Glossary</a></span></dt><dt><span class="appendix"><a href="#git-quick-start">A. Git Quick Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#managing-branches">Managing branches</a></span></dt><dt><span class="section"><a href="#exploring-history">Exploring history</a></span></dt><dt><span class="section"><a href="#making-changes">Making changes</a></span></dt><dt><span class="section"><a href="#merging">Merging</a></span></dt><dt><span class="section"><a href="#sharing-your-changes">Sharing your changes</a></span></dt><dt><span class="section"><a href="#repository-maintenance">Repository maintenance</a></span></dt></dl></dd><dt><span class="appendix"><a href="#todo">B. Notes and todo list for this manual</a></span></dt></dl></div><div class="preface" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id379378"></a>Preface</h2></div></div></div><p>Git is a fast distributed revision control system.</p><p>This manual is designed to be readable by someone with basic UNIX +<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Git User's Manual (for version 1.5.3 or newer)</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id461686"></a>Git User's Manual (for version 1.5.3 or newer)</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id539770">Preface</a></span></dt><dt><span class="chapter"><a href="#repositories-and-branches">1. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#examining-remote-branches">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-With-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#exploring-git-history">2. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#using-bisect">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#naming-commits">Naming commits</a></span></dt><dt><span class="section"><a href="#creating-tags">Creating tags</a></span></dt><dt><span class="section"><a href="#browsing-revisions">Browsing revisions</a></span></dt><dt><span class="section"><a href="#generating-diffs">Generating diffs</a></span></dt><dt><span class="section"><a href="#viewing-old-file-versions">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#history-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#counting-commits-on-a-branch">Counting the number of commits on a branch</a></span></dt><dt><span class="section"><a href="#checking-for-equal-branches">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#finding-tagged-descendants">Find first tagged version including a given fix</a></span></dt><dt><span class="section"><a href="#showing-commits-unique-to-a-branch">Showing commits unique to a given branch</a></span></dt><dt><span class="section"><a href="#making-a-release">Creating a changelog and tarball for a software release</a></span></dt><dt><span class="section"><a href="#Finding-comments-With-given-Content">Finding commits referencing a file with given content</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Developing-With-git">3. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#conflict-resolution">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-rewriting-history">Fixing a mistake by rewriting history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sharing-development">4. Sharing development with others</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-updates-With-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#forcing-push">What to do when a push fails</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">5. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git rebase</a></span></dt><dt><span class="section"><a href="#rewriting-one-commit">Rewriting a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-With-rewriting-history">Problems with rewriting history</a></span></dt><dt><span class="section"><a href="#bisect-merges">Why bisecting merge commits can be harder than bisecting linear history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#advanced-branch-management">6. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-concepts">7. Git concepts</a></span></dt><dd><dl><dt><span class="section"><a href="#the-object-database">The Object Database</a></span></dt><dd><dl><dt><span class="section"><a href="#commit-object">Commit Object</a></span></dt><dt><span class="section"><a href="#tree-object">Tree Object</a></span></dt><dt><span class="section"><a href="#blob-object">Blob Object</a></span></dt><dt><span class="section"><a href="#trust">Trust</a></span></dt><dt><span class="section"><a href="#tag-object">Tag Object</a></span></dt><dt><span class="section"><a href="#pack-files">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt><dt><span class="section"><a href="#recovering-from-repository-corruption">Recovering from repository corruption</a></span></dt></dl></dd><dt><span class="section"><a href="#the-index">The index</a></span></dt></dl></dd><dt><span class="chapter"><a href="#submodules">8. Submodules</a></span></dt><dd><dl><dt><span class="section"><a href="#_pitfalls_with_submodules">Pitfalls with submodules</a></span></dt></dl></dd><dt><span class="chapter"><a href="#low-level-operations">9. Low-level git operations</a></span></dt><dd><dl><dt><span class="section"><a href="#object-manipulation">Object access and manipulation</a></span></dt><dt><span class="section"><a href="#the-workflow">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#working-directory-to-index">working directory -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-object-database">index -&gt; object database</a></span></dt><dt><span class="section"><a href="#object-database-to-index">object database -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-working-directory">index -&gt; working directory</a></span></dt><dt><span class="section"><a href="#tying-it-all-together">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#examining-the-data">Examining the data</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees-2">Merging multiple trees, continued</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hacking-git">10. Hacking git</a></span></dt><dd><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">11. GIT Glossary</a></span></dt><dt><span class="appendix"><a href="#git-quick-start">A. Git Quick Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#managing-branches">Managing branches</a></span></dt><dt><span class="section"><a href="#exploring-history">Exploring history</a></span></dt><dt><span class="section"><a href="#making-changes">Making changes</a></span></dt><dt><span class="section"><a href="#merging">Merging</a></span></dt><dt><span class="section"><a href="#sharing-your-changes">Sharing your changes</a></span></dt><dt><span class="section"><a href="#repository-maintenance">Repository maintenance</a></span></dt></dl></dd><dt><span class="appendix"><a href="#todo">B. Notes and todo list for this manual</a></span></dt></dl></div><div class="preface" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id539770"></a>Preface</h2></div></div></div><p>Git is a fast distributed revision control system.</p><p>This manual is designed to be readable by someone with basic UNIX  command-line skills, but no previous knowledge of git.</p><p><a class="xref" href="#repositories-and-branches" title="Chapter 1. Repositories and Branches">Chapter 1, <i>Repositories and Branches</i></a> and <a class="xref" href="#exploring-git-history" title="Chapter 2. Exploring git history">Chapter 2, <i>Exploring git history</i></a> explain how  to fetch and study a project using git—read these chapters to learn how  to build and test a particular version of a software project, search for @@ -8,7 +8,7 @@  "git clone &lt;repo&gt;", you can either use:</p><div class="literallayout"><p>$ man git-clone</p></div><p>or:</p><div class="literallayout"><p>$ git help clone</p></div><p>With the latter, you can use the manual viewer of your choice; see  <a class="ulink" href="git-help.html" target="_top">git-help(1)</a> for more information.</p><p>See also <a class="xref" href="#git-quick-start" title="Appendix A. Git Quick Reference">Appendix A, <i>Git Quick Reference</i></a> for a brief overview of git commands,  without any explanation.</p><p>Finally, see <a class="xref" href="#todo" title="Appendix B. Notes and todo list for this manual">Appendix B, <i>Notes and todo list for this manual</i></a> for ways that you can help make this manual more -complete.</p></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="repositories-and-branches"></a>Chapter 1. Repositories and Branches</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#examining-remote-branches">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-With-git-fetch">Updating a repository with git-fetch</a></span></dt><dt><span class="section"><a href="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="how-to-get-a-git-repository"></a>How to get a git repository</h2></div></div></div><p>It will be useful to have a git repository to experiment with as you +complete.</p></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="repositories-and-branches"></a>Chapter 1. Repositories and Branches</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#examining-remote-branches">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-With-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="how-to-get-a-git-repository"></a>How to get a git repository</h2></div></div></div><p>It will be useful to have a git repository to experiment with as you  read this manual.</p><p>The best way to get one is by using the <a class="ulink" href="git-clone.html" target="_top">git-clone(1)</a> command to  download a copy of an existing repository. If you don't already have a  project in mind, here are some interesting examples:</p><div class="literallayout"><p>        # git itself (approx. 10MB download):<br> @@ -79,7 +79,7 @@  <br>          if (mkdir(".git", 0755) &lt; 0) {</p></div><p>As you can see, a commit shows who made the latest change, what they  did, and why.</p><p>Every commit has a 40-hexdigit id, sometimes called the "object name" or the -"SHA1 id", shown on the first line of the "git-show" output. You can usually +"SHA-1 id", shown on the first line of the "git show" output. You can usually  refer to a commit by a shorter name, such as a tag or a branch name, but this  longer name can also be useful. Most importantly, it is a globally unique  name for this commit: so if you tell somebody else the object name (for @@ -158,14 +158,14 @@  </dd></dl></div><p>The special symbol "HEAD" can always be used to refer to the current  branch. In fact, git uses a file named "HEAD" in the .git directory to  remember which branch is current:</p><div class="literallayout"><p>$ cat .git/HEAD<br> -ref: refs/heads/master</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="detached-head"></a>Examining an old version without creating a new branch</h2></div></div></div><p>The git-checkout command normally expects a branch head, but will also +ref: refs/heads/master</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="detached-head"></a>Examining an old version without creating a new branch</h2></div></div></div><p>The <code class="literal">git checkout</code> command normally expects a branch head, but will also  accept an arbitrary commit; for example, you can check out the commit  referenced by a tag:</p><div class="literallayout"><p>$ git checkout v2.6.17<br>  Note: moving to "v2.6.17" which isn't a local branch<br>  If you want to create a new branch from this checkout, you may do so<br>  (now or later) by using -b with the checkout command again. Example:<br>    git checkout -b &lt;new_branch_name&gt;<br> -HEAD is now at 427abfa... Linux v2.6.17</p></div><p>The HEAD then refers to the SHA1 of the commit instead of to a branch, +HEAD is now at 427abfa... Linux v2.6.17</p></div><p>The HEAD then refers to the SHA-1 of the commit instead of to a branch,  and git branch shows that you are no longer on a branch:</p><div class="literallayout"><p>$ cat .git/HEAD<br>  427abfa28afedffadfca9dd8b067eb6d36bac53f<br>  $ git branch<br> @@ -204,7 +204,7 @@  is usually a shortcut for the HEAD branch in the repository "origin".</p><p>For the complete list of paths which git checks for references, and  the order it uses to decide which to choose when there are multiple  references with the same shorthand name, see the "SPECIFYING -REVISIONS" section of <a class="ulink" href="git-rev-parse.html" target="_top">git-rev-parse(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Updating-a-repository-With-git-fetch"></a>Updating a repository with git-fetch</h2></div></div></div><p>Eventually the developer cloned from will do additional work in her +REVISIONS" section of <a class="ulink" href="git-rev-parse.html" target="_top">git-rev-parse(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="Updating-a-repository-With-git-fetch"></a>Updating a repository with git fetch</h2></div></div></div><p>Eventually the developer cloned from will do additional work in her  repository, creating new commits and advancing the branches to point  at the new commits.</p><p>The command "git fetch", with no arguments, will update all of the  remote-tracking branches to the latest version found in her @@ -214,7 +214,7 @@  $ git fetch linux-nfs<br>  * refs/remotes/linux-nfs/master: storing branch 'master' ...<br>    commit: bf81b46</p></div><p>New remote-tracking branches will be stored under the shorthand name -that you gave "git-remote add", in this case linux-nfs:</p><div class="literallayout"><p>$ git branch -r<br> +that you gave "git remote add", in this case linux-nfs:</p><div class="literallayout"><p>$ git branch -r<br>  linux-nfs/master<br>  origin/master</p></div><p>If you run "git fetch &lt;remote&gt;" later, the tracking branches for the  named &lt;remote&gt; will be updated.</p><p>If you examine the file .git/config, you will see that git has added @@ -251,7 +251,7 @@  half each time.</p><p>After about 13 tests (in this case), it will output the commit id of  the guilty commit. You can then examine the commit with  <a class="ulink" href="git-show.html" target="_top">git-show(1)</a>, find out who wrote it, and mail them your bug -report with the commit id. Finally, run</p><div class="literallayout"><p>$ git bisect reset</p></div><p>to return you to the branch you were on before.</p><p>Note that the version which git-bisect checks out for you at each +report with the commit id. Finally, run</p><div class="literallayout"><p>$ git bisect reset</p></div><p>to return you to the branch you were on before.</p><p>Note that the version which <code class="literal">git bisect</code> checks out for you at each  point is just a suggestion, and you're free to try a different  version if you think it would be a good idea. For example,  occasionally you may land on a commit that broke something unrelated; @@ -286,9 +286,9 @@  also choose:</p><div class="literallayout"><p>$ git show HEAD^1   # show the first parent of HEAD<br>  $ git show HEAD^2   # show the second parent of HEAD</p></div><p>In addition to HEAD, there are several other special names for  commits:</p><p>Merges (to be discussed later), as well as operations such as -git-reset, which change the currently checked-out commit, generally -set ORIG_HEAD to the value HEAD had before the current operation.</p><p>The git-fetch operation always stores the head of the last fetched -branch in FETCH_HEAD. For example, if you run git fetch without +<code class="literal">git reset</code>, which change the currently checked-out commit, generally +set ORIG_HEAD to the value HEAD had before the current operation.</p><p>The <code class="literal">git fetch</code> operation always stores the head of the last fetched +branch in FETCH_HEAD. For example, if you run <code class="literal">git fetch</code> without  specifying a local branch as the target of the operation</p><div class="literallayout"><p>$ git fetch git://example.com/proj.git theirbranch</p></div><p>the fetched commits will still be available from FETCH_HEAD.</p><p>When we discuss merges we'll also see the special name MERGE_HEAD,  which refers to the other branch that we're merging in to the current  branch.</p><p>The <a class="ulink" href="git-rev-parse.html" target="_top">git-rev-parse(1)</a> command is a low-level command that is @@ -325,7 +325,7 @@  anything out; this command does that:</p><div class="literallayout"><p>$ git show v2.5:fs/locks.c</p></div><p>Before the colon may be anything that names a commit, and after it  may be any path to a file tracked by git.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="history-examples"></a>Examples</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="counting-commits-on-a-branch"></a>Counting the number of commits on a branch</h3></div></div></div><p>Suppose you want to know how many commits you've made on "mybranch"  since it diverged from "origin":</p><div class="literallayout"><p>$ git log --pretty=oneline origin..mybranch | wc -l</p></div><p>Alternatively, you may often see this sort of thing done with the -lower-level command <a class="ulink" href="git-rev-list.html" target="_top">git-rev-list(1)</a>, which just lists the SHA1's +lower-level command <a class="ulink" href="git-rev-list.html" target="_top">git-rev-list(1)</a>, which just lists the SHA-1's  of all the given commits:</p><div class="literallayout"><p>$ git rev-list origin..mybranch | wc -l</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="checking-for-equal-branches"></a>Check whether two branches point at the same history</h3></div></div></div><p>Suppose you want to check whether two branches point at the same point  in history.</p><div class="literallayout"><p>$ git diff origin..master</p></div><p>will tell you whether the contents of the project are the same at the  two branches; in theory, however, it's possible that the same project @@ -424,9 +424,9 @@  that of the HEAD. The command "git diff —cached", which shows  the difference between the HEAD and the index, should therefore  produce no output at that point.</p><p>Modifying the index is easy:</p><p>To update the index with the new contents of a modified file, use</p><div class="literallayout"><p>$ git add path/to/file</p></div><p>To add the contents of a new file to the index, use</p><div class="literallayout"><p>$ git add path/to/file</p></div><p>To remove a file from the index and from the working tree,</p><div class="literallayout"><p>$ git rm path/to/file</p></div><p>After each step you can verify that</p><div class="literallayout"><p>$ git diff --cached</p></div><p>always shows the difference between the HEAD and the index file—this -is what you'd commit if you created the commit now—and that</p><div class="literallayout"><p>$ git diff</p></div><p>shows the difference between the working tree and the index file.</p><p>Note that "git-add" always adds just the current contents of a file +is what you'd commit if you created the commit now—and that</p><div class="literallayout"><p>$ git diff</p></div><p>shows the difference between the working tree and the index file.</p><p>Note that "git add" always adds just the current contents of a file  to the index; further changes to the same file will be ignored unless -you run git-add on the file again.</p><p>When you're ready, just run</p><div class="literallayout"><p>$ git commit</p></div><p>and git will prompt you for a commit message and then create the new +you run <code class="literal">git add</code> on the file again.</p><p>When you're ready, just run</p><div class="literallayout"><p>$ git commit</p></div><p>and git will prompt you for a commit message and then create the new  commit. Check to make sure it looks like what you expected with</p><div class="literallayout"><p>$ git show</p></div><p>As a special shortcut,</p><div class="literallayout"><p>$ git commit -a</p></div><p>will update the index with any files that you've modified or removed  and create a commit, all in one step.</p><p>A number of commands are useful for keeping track of what you're  about to commit:</p><div class="literallayout"><p>$ git diff --cached # difference between HEAD and the index; what<br> @@ -447,7 +447,7 @@  body.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ignoring-files"></a>Ignoring files</h2></div></div></div><p>A project will often generate files that you do <span class="emphasis"><em>not</em></span> want to track with git.  This typically includes files generated by a build process or temporary  backup files made by your editor. Of course, <span class="emphasis"><em>not</em></span> tracking files with git -is just a matter of <span class="emphasis"><em>not</em></span> calling <code class="literal">git-add</code> on them. But it quickly becomes +is just a matter of <span class="emphasis"><em>not</em></span> calling <code class="literal">git add</code> on them. But it quickly becomes  annoying to have these untracked files lying around; e.g. they make  <code class="literal">git add .</code> practically useless, and they keep showing up in the output of  <code class="literal">git status</code>.</p><p>You can tell git to ignore certain files by creating a file called .gitignore @@ -548,7 +548,7 @@  $ gitk --merge</p></div><p>These will display all commits which exist only on HEAD or on  MERGE_HEAD, and which touch an unmerged file.</p><p>You may also use <a class="ulink" href="git-mergetool.html" target="_top">git-mergetool(1)</a>, which lets you merge the  unmerged files using external tools such as Emacs or kdiff3.</p><p>Each time you resolve the conflicts in a file and update the index:</p><div class="literallayout"><p>$ git add file.txt</p></div><p>the different stages of that file will be "collapsed", after which -git-diff will (by default) no longer show diffs for that file.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="undoing-a-merge"></a>Undoing a merge</h2></div></div></div><p>If you get stuck and decide to just give up and throw the whole mess +<code class="literal">git diff</code> will (by default) no longer show diffs for that file.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="undoing-a-merge"></a>Undoing a merge</h2></div></div></div><p>If you get stuck and decide to just give up and throw the whole mess  away, you can always return to the pre-merge state with</p><div class="literallayout"><p>$ git reset --hard HEAD</p></div><p>Or, if you've already committed the merge that you want to throw away,</p><div class="literallayout"><p>$ git reset --hard ORIG_HEAD</p></div><p>However, this last command can be dangerous in some cases—never  throw away a commit you have already committed if that commit may  itself have been merged into another branch, as doing so may confuse @@ -580,7 +580,7 @@  with the changes to be reverted, then you will be asked to fix  conflicts manually, just as in the case of <a class="link" href="#resolving-a-merge" title="Resolving a merge">resolving a merge</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="fixing-a-mistake-by-rewriting-history"></a>Fixing a mistake by rewriting history</h3></div></div></div><p>If the problematic commit is the most recent commit, and you have not  yet made that commit public, then you may just -<a class="link" href="#undoing-a-merge" title="Undoing a merge">destroy it using git-reset</a>.</p><p>Alternatively, you +<a class="link" href="#undoing-a-merge" title="Undoing a merge">destroy it using <code class="literal">git reset</code></a>.</p><p>Alternatively, you  can edit the working directory and update the index to fix your  mistake, just as if you were going to <a class="link" href="#how-to-make-a-commit" title="How to make a commit">create a new commit</a>, then run</p><div class="literallayout"><p>$ git commit --amend</p></div><p>which will replace the old commit by a new commit incorporating your  changes, giving you a chance to edit the old commit message first.</p><p>Again, you should never do this to a commit that may already have @@ -589,7 +589,7 @@  this is an advanced topic to be left for  <a class="link" href="#cleaning-up-history" title="Chapter 5. Rewriting history and maintaining patch series">another chapter</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="checkout-of-path"></a>Checking out an old version of a file</h3></div></div></div><p>In the process of undoing a previous bad change, you may find it  useful to check out an older version of a particular file using -<a class="ulink" href="git-checkout.html" target="_top">git-checkout(1)</a>. We've used git-checkout before to switch +<a class="ulink" href="git-checkout.html" target="_top">git-checkout(1)</a>. We've used <code class="literal">git checkout</code> before to switch  branches, but it has quite different behavior if it is given a path  name: the command</p><div class="literallayout"><p>$ git checkout HEAD^ path/to/file</p></div><p>replaces path/to/file by the contents it had in the commit HEAD^, and  also updates the index to match. It does not change branches.</p><p>If you just want to look at an old version of the file, without @@ -606,7 +606,7 @@  <code class="literal">git stash apply</code>:</p><div class="literallayout"><p>$ git stash apply</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ensuring-good-performance"></a>Ensuring good performance</h2></div></div></div><p>On large repositories, git depends on compression to keep the history  information from taking up too much space on disk or in memory.</p><p>This compression is not performed automatically. Therefore you  should occasionally run <a class="ulink" href="git-gc.html" target="_top">git-gc(1)</a>:</p><div class="literallayout"><p>$ git gc</p></div><p>to recompress the archive. This can be very time-consuming, so -you may prefer to run git-gc when you are not doing other work.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ensuring-reliability"></a>Ensuring reliability</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="checking-for-corruption"></a>Checking the repository for corruption</h3></div></div></div><p>The <a class="ulink" href="git-fsck.html" target="_top">git-fsck(1)</a> command runs a number of self-consistency checks +you may prefer to run <code class="literal">git gc</code> when you are not doing other work.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ensuring-reliability"></a>Ensuring reliability</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="checking-for-corruption"></a>Checking the repository for corruption</h3></div></div></div><p>The <a class="ulink" href="git-fsck.html" target="_top">git-fsck(1)</a> command runs a number of self-consistency checks  on the repository, and reports on any problems. This may take some  time. The most common warning by far is about "dangling" objects:</p><div class="literallayout"><p>$ git fsck<br>  dangling commit 7281251ddd2a61e38657c827739c57015671a6b3<br> @@ -641,7 +641,7 @@  suppose you delete a branch, then realize you need the history it  contained. The reflog is also deleted; however, if you have not yet  pruned the repository, then you may still be able to find the lost -commits in the dangling objects that git-fsck reports. See +commits in the dangling objects that <code class="literal">git fsck</code> reports. See  <a class="xref" href="#dangling-objects" title="Dangling objects">the section called “Dangling objects”</a> for the details.</p><div class="literallayout"><p>$ git fsck<br>  dangling commit 7281251ddd2a61e38657c827739c57015671a6b3<br>  dangling commit 2706a059f258c6b245f298dc4ff2ccd30ec21a63<br> @@ -655,9 +655,9 @@  "tip of the line" as being dangling, but there might be a whole deep  and complex commit history that was dropped.)</p><p>If you decide you want the history back, you can always create a new  reference pointing to it, for example, a new branch:</p><div class="literallayout"><p>$ git branch recovered-branch 7281251ddd</p></div><p>Other types of dangling objects (blobs and trees) are also possible, and -dangling objects can arise in other situations.</p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="sharing-development"></a>Chapter 4. Sharing development with others</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#getting-updates-With-git-pull">Getting updates with git-pull</a></span></dt><dt><span class="section"><a href="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#forcing-push">What to do when a push fails</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-updates-With-git-pull"></a>Getting updates with git-pull</h2></div></div></div><p>After you clone a repository and make a few changes of your own, you +dangling objects can arise in other situations.</p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="sharing-development"></a>Chapter 4. Sharing development with others</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#getting-updates-With-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#forcing-push">What to do when a push fails</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-updates-With-git-pull"></a>Getting updates with git pull</h2></div></div></div><p>After you clone a repository and make a few changes of your own, you  may wish to check the original repository for updates and merge them -into your own work.</p><p>We have already seen <a class="link" href="#Updating-a-repository-With-git-fetch" title="Updating a repository with git-fetch">how to keep remote tracking branches up to date</a> with <a class="ulink" href="git-fetch.html" target="_top">git-fetch(1)</a>, +into your own work.</p><p>We have already seen <a class="link" href="#Updating-a-repository-With-git-fetch" title="Updating a repository with git fetch">how to keep remote tracking branches up to date</a> with <a class="ulink" href="git-fetch.html" target="_top">git-fetch(1)</a>,  and how to merge two branches. So you can merge in changes from the  original repository's master branch with:</p><div class="literallayout"><p>$ git fetch<br>  $ git merge origin/master</p></div><p>However, the <a class="ulink" href="git-pull.html" target="_top">git-pull(1)</a> command provides a way to do this in @@ -671,7 +671,7 @@  producing a default commit message documenting the branch and  repository that you pulled from.</p><p>(But note that no such commit will be created in the case of a  <a class="link" href="#fast-forwards" title="Fast-forward merges">fast forward</a>; instead, your branch will just be -updated to point to the latest commit from the upstream branch.)</p><p>The git-pull command can also be given "." as the "remote" repository, +updated to point to the latest commit from the upstream branch.)</p><p>The <code class="literal">git pull</code> command can also be given "." as the "remote" repository,  in which case it just merges in a branch from the current repository; so  the commands</p><div class="literallayout"><p>$ git pull . branch<br>  $ git merge branch</p></div><p>are roughly equivalent. The former is actually very commonly used.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="submitting-patches"></a>Submitting patches to a project</h2></div></div></div><p>If you just have a few changes, the simplest way to submit them may @@ -693,7 +693,7 @@  the original mailbox, with authorship and commit log message each  taken from the message containing each patch.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="public-repositories"></a>Public git repositories</h2></div></div></div><p>Another way to submit changes to a project is to tell the maintainer  of that project to pull the changes from your repository using -<a class="ulink" href="git-pull.html" target="_top">git-pull(1)</a>. In the section "<a class="link" href="#getting-updates-With-git-pull" title="Getting updates with git-pull">Getting updates with git-pull</a>" we described this as a way to get +<a class="ulink" href="git-pull.html" target="_top">git-pull(1)</a>. In the section "<a class="link" href="#getting-updates-With-git-pull" title="Getting updates with git pull">Getting updates with <code class="literal">git pull</code></a>" we described this as a way to get  updates from the "main" repository, but it works just as well in the  other direction.</p><p>If you and the maintainer both have accounts on the same machine, then  you can just pull changes from each other's repositories directly; @@ -717,7 +717,7 @@  | |  | they push V  their public repo &lt;------------------- their repo</pre><p>We explain how to do this in the following sections.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="setting-up-a-public-repository"></a>Setting up a public repository</h3></div></div></div><p>Assume your personal repository is in the directory ~/proj. We -first create a new clone of the repository and tell git-daemon that it +first create a new clone of the repository and tell <code class="literal">git daemon</code> that it  is meant to be public:</p><div class="literallayout"><p>$ git clone --bare ~/proj proj.git<br>  $ touch proj.git/git-daemon-export-ok</p></div><p>The resulting directory proj.git contains a "bare" git repository—it is  just the contents of the ".git" directory, without any files checked out @@ -729,8 +729,8 @@  "<a class="link" href="#pushing-changes-to-a-public-repository" title="Pushing changes to a public repository">Pushing changes to a public repository</a>", below.</p><p>Otherwise, all you need to do is start <a class="ulink" href="git-daemon.html" target="_top">git-daemon(1)</a>; it will  listen on port 9418. By default, it will allow access to any directory  that looks like a git directory and contains the magic file -git-daemon-export-ok. Passing some directory paths as git-daemon -arguments will further restrict the exports to those paths.</p><p>You can also run git-daemon as an inetd service; see the +git-daemon-export-ok. Passing some directory paths as <code class="literal">git daemon</code> +arguments will further restrict the exports to those paths.</p><p>You can also run <code class="literal">git daemon</code> as an inetd service; see the  <a class="ulink" href="git-daemon.html" target="_top">git-daemon(1)</a> man page for details. (See especially the  examples section.)</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="exporting-via-http"></a>Exporting a git repository via http</h3></div></div></div><p>The git protocol gives better performance and reliability, but on a  host with a web server set up, http exports may be simpler to set up.</p><p>All you need to do is place the newly created bare git repository in @@ -749,13 +749,13 @@  access, which you will need to update the public repository with the  latest changes created in your private repository.</p><p>The simplest way to do this is using <a class="ulink" href="git-push.html" target="_top">git-push(1)</a> and ssh; to  update the remote branch named "master" with the latest state of your -branch named "master", run</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git master:master</p></div><p>or just</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git master</p></div><p>As with git-fetch, git-push will complain if this does not result in a +branch named "master", run</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git master:master</p></div><p>or just</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git master</p></div><p>As with <code class="literal">git fetch</code>, <code class="literal">git push</code> will complain if this does not result in a  <a class="link" href="#fast-forwards" title="Fast-forward merges">fast forward</a>; see the following section for details on  handling this case.</p><p>Note that the target of a "push" is normally a  <a class="link" href="#def_bare_repository">bare</a> repository. You can also push to a  repository that has a checked-out working tree, but the working tree  will not be updated by the push. This may lead to unexpected results if -the branch you push to is the currently checked-out branch!</p><p>As with git-fetch, you may also set up configuration options to +the branch you push to is the currently checked-out branch!</p><p>As with <code class="literal">git fetch</code>, you may also set up configuration options to  save typing; so, for example, after</p><div class="literallayout"><p>$ cat &gt;&gt;.git/config &lt;&lt;EOF<br>  [remote "public-repo"]<br>          url = ssh://yourserver.com/~you/proj.git<br> @@ -766,14 +766,14 @@   local  'refs/heads/master'.<br>   Maybe you are not up-to-date and need to pull first?<br>  error: failed to push to 'ssh://yourserver.com/~you/proj.git'</p></div><p>This can happen, for example, if you:</p><div class="itemizedlist"><ul type="disc"><li> -use <code class="literal">git-reset —hard</code> to remove already-published commits, or +use <code class="literal">git reset —hard</code> to remove already-published commits, or  </li><li> -use <code class="literal">git-commit —amend</code> to replace already-published commits +use <code class="literal">git commit —amend</code> to replace already-published commits  (as in <a class="xref" href="#fixing-a-mistake-by-rewriting-history" title="Fixing a mistake by rewriting history">the section called “Fixing a mistake by rewriting history”</a>), or  </li><li> -use <code class="literal">git-rebase</code> to rebase any already-published commits (as - in <a class="xref" href="#using-git-rebase" title="Keeping a patch series up to date using git-rebase">the section called “Keeping a patch series up to date using git-rebase”</a>). -</li></ul></div><p>You may force git-push to perform the update anyway by preceding the +use <code class="literal">git rebase</code> to rebase any already-published commits (as + in <a class="xref" href="#using-git-rebase" title="Keeping a patch series up to date using git rebase">the section called “Keeping a patch series up to date using git rebase”</a>). +</li></ul></div><p>You may force <code class="literal">git push</code> to perform the update anyway by preceding the  branch name with a plus sign:</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git +master</p></div><p>Normally whenever a branch head in a public repository is modified, it  is modified to point to a descendant of the commit that it pointed to  before. By forcing a push in this situation, you break that convention. @@ -796,7 +796,7 @@  advantages over the central shared repository:</p><div class="itemizedlist"><ul type="disc"><li>  Git's ability to quickly import and merge patches allows a  single maintainer to process incoming changes even at very - high rates. And when that becomes too much, git-pull provides + high rates. And when that becomes too much, <code class="literal">git pull</code> provides  an easy way for that maintainer to delegate this job to other  maintainers while still allowing optional review of incoming  changes. @@ -967,7 +967,7 @@                  ;;<br>          esac<br>          git log origin/master..$branch | git shortlog<br> -done</p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="cleaning-up-history"></a>Chapter 5. Rewriting history and maintaining patch series</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#rewriting-one-commit">Rewriting a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-With-rewriting-history">Problems with rewriting history</a></span></dt><dt><span class="section"><a href="#bisect-merges">Why bisecting merge commits can be harder than bisecting linear history</a></span></dt></dl></div><p>Normally commits are only added to a project, never taken away or +done</p></div></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="cleaning-up-history"></a>Chapter 5. Rewriting history and maintaining patch series</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git rebase</a></span></dt><dt><span class="section"><a href="#rewriting-one-commit">Rewriting a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-With-rewriting-history">Problems with rewriting history</a></span></dt><dt><span class="section"><a href="#bisect-merges">Why bisecting merge commits can be harder than bisecting linear history</a></span></dt></dl></div><p>Normally commits are only added to a project, never taken away or  replaced. Git is designed with this assumption, and violating it will  cause git's merge machinery (for example) to do the wrong thing.</p><p>However, there is a situation in which it can be useful to violate this  assumption.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="patch-series"></a>Creating the perfect patch series</h2></div></div></div><p>Suppose you are a contributor to a large project, and you want to add a @@ -989,7 +989,7 @@  (probably much messier!) development process did.  </li></ol></div><p>We will introduce some tools that can help you do this, explain how to  use them, and then explain some of the problems that can arise because -you are rewriting history.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-git-rebase"></a>Keeping a patch series up to date using git-rebase</h2></div></div></div><p>Suppose that you create a branch "mywork" on a remote-tracking branch +you are rewriting history.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-git-rebase"></a>Keeping a patch series up to date using git rebase</h2></div></div></div><p>Suppose that you create a branch "mywork" on a remote-tracking branch  "origin", and create some commits on top of it:</p><div class="literallayout"><p>$ git checkout -b mywork origin<br>  $ vi file.txt<br>  $ git commit<br> @@ -1013,15 +1013,15 @@  patches to the new mywork. The result will look like:</p><pre class="literallayout"> o--o--O--o--o--o &lt;-- origin  \  a'--b'--c' &lt;-- mywork</pre><p>In the process, it may discover conflicts. In that case it will stop -and allow you to fix the conflicts; after fixing conflicts, use "git-add" +and allow you to fix the conflicts; after fixing conflicts, use <code class="literal">git add</code>  to update the index with those contents, and then, instead of -running git-commit, just run</p><div class="literallayout"><p>$ git rebase --continue</p></div><p>and git will continue applying the rest of the patches.</p><p>At any point you may use the <code class="literal">—abort</code> option to abort this process and +running <code class="literal">git commit</code>, just run</p><div class="literallayout"><p>$ git rebase --continue</p></div><p>and git will continue applying the rest of the patches.</p><p>At any point you may use the <code class="literal">—abort</code> option to abort this process and  return mywork to the state it had before you started the rebase:</p><div class="literallayout"><p>$ git rebase --abort</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="rewriting-one-commit"></a>Rewriting a single commit</h2></div></div></div><p>We saw in <a class="xref" href="#fixing-a-mistake-by-rewriting-history" title="Fixing a mistake by rewriting history">the section called “Fixing a mistake by rewriting history”</a> that you can replace the  most recent commit using</p><div class="literallayout"><p>$ git commit --amend</p></div><p>which will replace the old commit by a new commit incorporating your  changes, giving you a chance to edit the old commit message first.</p><p>You can also use a combination of this and <a class="ulink" href="git-rebase.html" target="_top">git-rebase(1)</a> to  replace a commit further back in your history and recreate the  intervening changes on top of it. First, tag the problematic commit -with</p><div class="literallayout"><p>$ git tag bad mywork~5</p></div><p>(Either gitk or git-log may be useful for finding the commit.)</p><p>Then check out that commit, edit it, and rebase the rest of the series +with</p><div class="literallayout"><p>$ git tag bad mywork~5</p></div><p>(Either gitk or <code class="literal">git log</code> may be useful for finding the commit.)</p><p>Then check out that commit, edit it, and rebase the rest of the series  on top of it (note that we could check out the commit on a temporary  branch, but instead we're using a <a class="link" href="#detached-head" title="Examining an old version without creating a new branch">detached head</a>):</p><div class="literallayout"><p>$ git checkout bad<br>  $ # make changes here and update the index<br> @@ -1036,10 +1036,10 @@  series of patches on top of "origin", you might do something like:</p><div class="literallayout"><p>$ git checkout -b mywork-new origin<br>  $ gitk origin..mywork &amp;</p></div><p>and browse through the list of patches in the mywork branch using gitk,  applying them (possibly in a different order) to mywork-new using -cherry-pick, and possibly modifying them as you go using <code class="literal">commit —amend</code>. +cherry-pick, and possibly modifying them as you go using <code class="literal">git commit —amend</code>.  The <a class="ulink" href="git-gui.html" target="_top">git-gui(1)</a> command may also help as it allows you to  individually select diff hunks for inclusion in the index (by -right-clicking on the diff hunk and choosing "Stage Hunk for Commit").</p><p>Another technique is to use git-format-patch to create a series of +right-clicking on the diff hunk and choosing "Stage Hunk for Commit").</p><p>Another technique is to use <code class="literal">git format-patch</code> to create a series of  patches, then reset the state to before the patches:</p><div class="literallayout"><p>$ git format-patch origin<br>  $ git reset --hard origin</p></div><p>Then modify, reorder, or eliminate patches as preferred before applying  them again with <a class="ulink" href="git-am.html" target="_top">git-am(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="patch-series-tools"></a>Other tools</h2></div></div></div><p>There are numerous other tools, such as StGIT, which exist for the @@ -1085,7 +1085,7 @@  semantics introduced on the upper line of development. So if all  you know is that D is bad, that Z is good, and that  <a class="ulink" href="git-bisect.html" target="_top">git-bisect(1)</a> identifies C as the culprit, how will you -figure out that the problem is due to this change in semantics?</p><p>When the result of a git-bisect is a non-merge commit, you should +figure out that the problem is due to this change in semantics?</p><p>When the result of a <code class="literal">git bisect</code> is a non-merge commit, you should  normally be able to discover the problem by examining just that commit.  Developers can make this easy by breaking their changes into small  self-contained commits. That won't help in the case above, however, @@ -1099,7 +1099,7 @@  and understanding why Y* was broken would probably be easier.</p><p>Partly for this reason, many experienced git users, even when  working on an otherwise merge-heavy project, keep the history  linear by rebasing against the latest upstream version before -publishing.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="advanced-branch-management"></a>Chapter 6. Advanced branch management</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git-fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="fetching-individual-branches"></a>Fetching individual branches</h2></div></div></div><p>Instead of using <a class="ulink" href="git-remote.html" target="_top">git-remote(1)</a>, you can also choose just +publishing.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="advanced-branch-management"></a>Chapter 6. Advanced branch management</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="fetching-individual-branches"></a>Fetching individual branches</h2></div></div></div><p>Instead of using <a class="ulink" href="git-remote.html" target="_top">git-remote(1)</a>, you can also choose just  to update one branch at a time, and to store it locally under an  arbitrary name:</p><div class="literallayout"><p>$ git fetch origin todo:my-todo-work</p></div><p>The first argument, "origin", just tells git to fetch from the  repository you originally cloned from. The second argument tells git @@ -1108,7 +1108,7 @@  branch named "master" from the repository at the given URL. If you  already have a branch named example-master, it will attempt to  <a class="link" href="#fast-forwards" title="Fast-forward merges">fast-forward</a> to the commit given by example.com's -master branch. In more detail:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="fetch-fast-forwards"></a>git fetch and fast-forwards</h2></div></div></div><p>In the previous example, when updating an existing branch, "git-fetch" +master branch. In more detail:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="fetch-fast-forwards"></a>git fetch and fast-forwards</h2></div></div></div><p>In the previous example, when updating an existing branch, "git fetch"  checks to make sure that the most recent commit on the remote  branch is a descendant of the most recent commit on your copy of the  branch before updating your copy of the branch to point at the new @@ -1119,11 +1119,11 @@  realized she made a serious mistake, and decided to backtrack,  resulting in a situation like:</p><pre class="literallayout"> o--o--o--o--a--b &lt;-- old head of the branch  \ - o--o--o &lt;-- new head of the branch</pre><p>In this case, "git-fetch" will fail, and print out a warning.</p><p>In that case, you can still force git to update to the new head, as + o--o--o &lt;-- new head of the branch</pre><p>In this case, "git fetch" will fail, and print out a warning.</p><p>In that case, you can still force git to update to the new head, as  described in the following section. However, note that in the  situation above this may mean losing the commits labeled "a" and "b",  unless you've already created a reference of your own pointing to -them.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="forcing-fetch"></a>Forcing git-fetch to do non-fast-forward updates</h2></div></div></div><p>If git fetch fails because the new head of a branch is not a +them.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="forcing-fetch"></a>Forcing git fetch to do non-fast-forward updates</h2></div></div></div><p>If git fetch fails because the new head of a branch is not a  descendant of the old head, you may force the update with:</p><div class="literallayout"><p>$ git fetch git://example.com/proj.git +master:refs/remotes/example/master</p></div><p>Note the addition of the "+" sign. Alternatively, you can use the "-f"  flag to force updates of all the fetched branches, as in:</p><div class="literallayout"><p>$ git fetch -f origin</p></div><p>Be aware that commits that the old version of example/master pointed at  may be lost, as we saw in the previous section.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="remote-branch-configuration"></a>Configuring remote branches</h2></div></div></div><p>We saw above that "origin" is just a shortcut to refer to the @@ -1150,8 +1150,8 @@  git much more intuitive if you do.</p><p>We start with the most important, the <a class="link" href="#def_object_database">object database</a> and the <a class="link" href="#def_index">index</a>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="the-object-database"></a>The Object Database</h2></div></div></div><p>We already saw in <a class="xref" href="#understanding-commits" title="Understanding History: Commits">the section called “Understanding History: Commits”</a> that all commits are stored  under a 40-digit "object name". In fact, all the information needed to  represent the history of a project is stored in objects with such names. -In each case the name is calculated by taking the SHA1 hash of the -contents of the object. The SHA1 hash is a cryptographic hash function. +In each case the name is calculated by taking the SHA-1 hash of the +contents of the object. The SHA-1 hash is a cryptographic hash function.  What that means to us is that it is impossible to find two different  objects with the same name. This has a number of advantages; among  others:</p><div class="itemizedlist"><ul type="disc"><li> @@ -1163,9 +1163,9 @@  the same name.  </li><li>  Git can detect errors when it reads an object, by checking that the - object's name is still the SHA1 hash of its contents. + object's name is still the SHA-1 hash of its contents.  </li></ul></div><p>(See <a class="xref" href="#object-details" title="Object storage format">the section called “Object storage format”</a> for the details of the object formatting and -SHA1 calculation.)</p><p>There are four different types of objects: "blob", "tree", "commit", and +SHA-1 calculation.)</p><p>There are four different types of objects: "blob", "tree", "commit", and  "tag".</p><div class="itemizedlist"><ul type="disc"><li>  A <a class="link" href="#def_blob_object">"blob" object</a> is used to store file data.  </li><li> @@ -1197,10 +1197,10 @@      Fix misspelling of 'suppress' in docs<br>  <br>      Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;</p></div><p>As you can see, a commit is defined by:</p><div class="itemizedlist"><ul type="disc"><li> -a tree: The SHA1 name of a tree object (as defined below), representing +a tree: The SHA-1 name of a tree object (as defined below), representing  the contents of a directory at a certain point in time.  </li><li> -parent(s): The SHA1 name of some number of commits which represent the +parent(s): The SHA-1 name of some number of commits which represent the  immediately previous step(s) in the history of the project. The  example above has one parent; merge commits may have more than  one. A commit with no parents is called a "root" commit, and @@ -1237,11 +1237,11 @@  100644 blob 4eb463797adc693dc168b926b6932ff53f17d0b1    Makefile<br>  100644 blob 548142c327a6790ff8821d67c2ee1eff7a656b52    README<br>  ...</p></div><p>As you can see, a tree object contains a list of entries, each with a -mode, object type, SHA1 name, and name, sorted by name. It represents +mode, object type, SHA-1 name, and name, sorted by name. It represents  the contents of a single directory tree.</p><p>The object type may be a blob, representing the contents of a file, or  another tree, representing the contents of a subdirectory. Since trees -and blobs, like all other objects, are named by the SHA1 hash of their -contents, two trees have the same SHA1 name if and only if their +and blobs, like all other objects, are named by the SHA-1 hash of their +contents, two trees have the same SHA-1 name if and only if their  contents (including, recursively, the contents of all subdirectories)  are identical. This allows git to quickly determine the differences  between two related tree objects, since it can ignore any entries with @@ -1261,13 +1261,13 @@  renaming a file does not change the object that file is associated with.</p><p>Note that any tree or blob object can be examined using  <a class="ulink" href="git-show.html" target="_top">git-show(1)</a> with the &lt;revision&gt;:&lt;path&gt; syntax. This can  sometimes be useful for browsing the contents of a tree that is not -currently checked out.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="trust"></a>Trust</h3></div></div></div><p>If you receive the SHA1 name of a blob from one source, and its contents +currently checked out.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="trust"></a>Trust</h3></div></div></div><p>If you receive the SHA-1 name of a blob from one source, and its contents  from another (possibly untrusted) source, you can still trust that those -contents are correct as long as the SHA1 name agrees. This is because -the SHA1 is designed so that it is infeasible to find different contents -that produce the same hash.</p><p>Similarly, you need only trust the SHA1 name of a top-level tree object +contents are correct as long as the SHA-1 name agrees. This is because +the SHA-1 is designed so that it is infeasible to find different contents +that produce the same hash.</p><p>Similarly, you need only trust the SHA-1 name of a top-level tree object  to trust the contents of the entire directory that it refers to, and if -you receive the SHA1 name of a commit from a trusted source, then you +you receive the SHA-1 name of a commit from a trusted source, then you  can easily verify the entire history of commits reachable through  parents of that commit, and all of those contents of the trees referred  to by those commits.</p><p>So to introduce some real trust in the system, the only thing you need @@ -1275,7 +1275,7 @@  name of a top-level commit. Your digital signature shows others  that you trust that commit, and the immutability of the history of  commits tells others that they can trust the whole history.</p><p>In other words, you can easily validate a whole archive by just -sending out a single email that tells the people the name (SHA1 hash) +sending out a single email that tells the people the name (SHA-1 hash)  of the top commit, and digitally sign that email using something  like GPG/PGP.</p><p>To assist in this, git also provides the tag object…</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="tag-object"></a>Tag Object</h3></div></div></div><p>A tag object contains an object, object type, tag name, the name of the  person ("tagger") who created the tag, and a message, which may contain @@ -1296,7 +1296,7 @@  objects. (Note that <a class="ulink" href="git-tag.html" target="_top">git-tag(1)</a> can also be used to create  "lightweight tags", which are not tag objects at all, but just simple  references whose names begin with "refs/tags/").</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="pack-files"></a>How git stores objects efficiently: pack files</h3></div></div></div><p>Newly created objects are initially created in a file named after the -object's SHA1 hash (stored in .git/objects).</p><p>Unfortunately this system becomes inefficient once a project has a +object's SHA-1 hash (stored in .git/objects).</p><p>Unfortunately this system becomes inefficient once a project has a  lot of objects. Try this on an old project:</p><div class="literallayout"><p>$ git count-objects<br>  6930 objects, 47620 kilobytes</p></div><p>The first number is the number of objects which are kept in  individual files. The second is the amount of space taken up by @@ -1313,7 +1313,7 @@  Total 6020, written 6020 (delta 4070), reused 0 (delta 0)<br>  Pack pack-3e54ad29d5b2e05838c75df582c65257b8d08e1c created.</p></div><p>You can then run</p><div class="literallayout"><p>$ git prune</p></div><p>to remove any of the "loose" objects that are now contained in the  pack. This will also remove any unreferenced objects (which may be -created when, for example, you use "git-reset" to remove a commit). +created when, for example, you use "git reset" to remove a commit).  You can verify that the loose objects are gone by looking at the  .git/objects directory or by running</p><div class="literallayout"><p>$ git count-objects<br>  0 objects, 0 kilobytes</p></div><p>Although the object files are gone, any commands that refer to those @@ -1324,7 +1324,7 @@  <a class="xref" href="#cleaning-up-history" title="Chapter 5. Rewriting history and maintaining patch series">Chapter 5, <i>Rewriting history and maintaining patch series</i></a>. In that case, the old head of the original  branch still exists, as does everything it pointed to. The branch  pointer itself just doesn't, since you replaced it with another one.</p><p>There are also other situations that cause dangling objects. For -example, a "dangling blob" may arise because you did a "git-add" of a +example, a "dangling blob" may arise because you did a "git add" of a  file, but then, before you actually committed it and made it part of the  bigger picture, you changed something else in that file and committed  that <span class="strong"><strong>updated</strong></span> thing—the old state that you added originally ends up @@ -1348,14 +1348,14 @@  almost always the result of either being a half-way mergebase (the blob  will often even have the conflict markers from a merge in it, if you  have had conflicting merges that you fixed up by hand), or simply -because you interrupted a "git-fetch" with ^C or something like that, +because you interrupted a "git fetch" with ^C or something like that,  leaving <span class="emphasis"><em>some</em></span> of the new objects in the object database, but just  dangling and useless.</p><p>Anyway, once you are sure that you're not interested in any dangling  state, you can just prune all unreachable objects:</p><div class="literallayout"><p>$ git prune</p></div><p>and they'll be gone. But you should only run "git prune" on a quiescent  repository—it's kind of like doing a filesystem fsck recovery: you -don't want to do that while the filesystem is mounted.</p><p>(The same is true of "git-fsck" itself, btw, but since -git-fsck never actually <span class="strong"><strong>changes</strong></span> the repository, it just reports -on what it found, git-fsck itself is never "dangerous" to run. +don't want to do that while the filesystem is mounted.</p><p>(The same is true of "git fsck" itself, btw, but since +<code class="literal">git fsck</code> never actually <span class="strong"><strong>changes</strong></span> the repository, it just reports +on what it found, <code class="literal">git fsck</code> itself is never <span class="emphasis"><em>dangerous</em></span> to run.  Running it while somebody is actually changing the repository can cause  confusing and scary messages, but it won't actually do anything bad. In  contrast, running "git prune" while somebody is actively changing the @@ -1389,7 +1389,7 @@  the same as the copy you have checked out in your working tree at  "somedirectory/myfile"; you can test whether that's right with  <a class="ulink" href="git-hash-object.html" target="_top">git-hash-object(1)</a>:</p><div class="literallayout"><p>$ git hash-object -w somedirectory/myfile</p></div><p>which will create and store a blob object with the contents of -somedirectory/myfile, and output the sha1 of that object. if you're +somedirectory/myfile, and output the SHA-1 of that object. if you're  extremely lucky it might be 4b9458b3786228369c63936db65827de3cc06200, in  which case you've guessed right, and the corruption is fixed!</p><p>Otherwise, you need more information. How do you tell which version of  the file has been lost?</p><p>The easiest way to do this is with:</p><div class="literallayout"><p>$ git log --raw --all --full-history -- somedirectory/myfile</p></div><p>Because you're asking for raw output, you'll now get something like</p><div class="literallayout"><p>commit abc<br> @@ -1411,7 +1411,7 @@  shot at reconstructing the contents of the in-between state 4b9458b.</p><p>If you can do that, you can now recreate the missing object with</p><div class="literallayout"><p>$ git hash-object -w &lt;recreated-file&gt;</p></div><p>and your repository is good again!</p><p>(Btw, you could have ignored the fsck, and started with doing a</p><div class="literallayout"><p>$ git log --raw --all</p></div><p>and just looked for the sha of the missing object (4b9458b..) in that  whole thing. It's up to you - git does <span class="strong"><strong>have</strong></span> a lot of information, it is  just missing one particular blob version.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="the-index"></a>The index</h2></div></div></div><p>The index is a binary file (generally kept in .git/index) containing a -sorted list of path names, each with permissions and the SHA1 of a blob +sorted list of path names, each with permissions and the SHA-1 of a blob  object; <a class="ulink" href="git-ls-files.html" target="_top">git-ls-files(1)</a> can show you the contents of the index:</p><div class="literallayout"><p>$ git ls-files --stage<br>  100644 63c918c667fa005ff12ad89437f2fdc80926e21c 0       .gitignore<br>  100644 5529b198e8d14decbe4ad99db3f7fb632de0439d 0       .mailmap<br> @@ -1493,8 +1493,8 @@  $ for i in a b c d<br>  do<br>          git submodule add ~/git/$i $i<br> -done</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Do not use local URLs here if you plan to publish your superproject!</p></div><p>See what files <code class="literal">git-submodule</code> created:</p><div class="literallayout"><p>$ ls -a<br> -.  ..  .git  .gitmodules  a  b  c  d</p></div><p>The <code class="literal">git-submodule add &lt;repo&gt; &lt;path&gt;</code> command does a couple of things:</p><div class="itemizedlist"><ul type="disc"><li> +done</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Do not use local URLs here if you plan to publish your superproject!</p></div><p>See what files <code class="literal">git submodule</code> created:</p><div class="literallayout"><p>$ ls -a<br> +.  ..  .git  .gitmodules  a  b  c  d</p></div><p>The <code class="literal">git submodule add &lt;repo&gt; &lt;path&gt;</code> command does a couple of things:</p><div class="itemizedlist"><ul type="disc"><li>  It clones the submodule from &lt;repo&gt; to the given &lt;path&gt; under the  current directory and by default checks out the master branch.  </li><li> @@ -1514,12 +1514,12 @@  -d96249ff5d57de5de093e6baff9e0aafa5276a74 d</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The commit object names shown above would be different for you, but they  should match the HEAD commit object names of your repositories. You can check  it by running <code class="literal">git ls-remote ../a</code>.</p></div><p>Pulling down the submodules is a two-step process. First run <code class="literal">git submodule -init</code> to add the submodule repository URLs to <code class="literal">.git/config</code>:</p><div class="literallayout"><p>$ git submodule init</p></div><p>Now use <code class="literal">git-submodule update</code> to clone the repositories and check out the +init</code> to add the submodule repository URLs to <code class="literal">.git/config</code>:</p><div class="literallayout"><p>$ git submodule init</p></div><p>Now use <code class="literal">git submodule update</code> to clone the repositories and check out the  commits specified in the superproject:</p><div class="literallayout"><p>$ git submodule update<br>  $ cd a<br>  $ ls -a<br> -.  ..  .git  a.txt</p></div><p>One major difference between <code class="literal">git-submodule update</code> and <code class="literal">git-submodule add</code> is -that <code class="literal">git-submodule update</code> checks out a specific commit, rather than the tip +.  ..  .git  a.txt</p></div><p>One major difference between <code class="literal">git submodule update</code> and <code class="literal">git submodule add</code> is +that <code class="literal">git submodule update</code> checks out a specific commit, rather than the tip  of a branch. It's like checking out a tag: the head is detached, so you're not  working on a branch.</p><div class="literallayout"><p>$ git branch<br>  * (no branch)<br> @@ -1608,16 +1608,16 @@  other direction:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="object-database-to-index"></a>object database -&gt; index</h3></div></div></div><p>You read a "tree" file from the object database, and use that to  populate (and overwrite—don't do this if your index contains any  unsaved state that you might want to restore later!) your current -index. Normal operation is just</p><div class="literallayout"><p>$ git read-tree &lt;sha1 of tree&gt;</p></div><p>and your index file will now be equivalent to the tree that you saved +index. Normal operation is just</p><div class="literallayout"><p>$ git read-tree &lt;SHA-1 of tree&gt;</p></div><p>and your index file will now be equivalent to the tree that you saved  earlier. However, that is only your <span class="emphasis"><em>index</em></span> file: your working  directory contents have not been modified.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="index-to-working-directory"></a>index -&gt; working directory</h3></div></div></div><p>You update your working directory from the index by "checking out"  files. This is not a very common operation, since normally you'd just  keep your files updated, and rather than write to your working  directory, you'd tell the index files about the changes in your -working directory (i.e. <code class="literal">git-update-index</code>).</p><p>However, if you decide to jump to a new version, or check out somebody +working directory (i.e. <code class="literal">git update-index</code>).</p><p>However, if you decide to jump to a new version, or check out somebody  else's version, or just restore a previous tree, you'd populate your  index file with read-tree, and then you need to check out the result -with</p><div class="literallayout"><p>$ git checkout-index filename</p></div><p>or, if you want to check out all of the index, use <code class="literal">-a</code>.</p><p>NOTE! git-checkout-index normally refuses to overwrite old files, so +with</p><div class="literallayout"><p>$ git checkout-index filename</p></div><p>or, if you want to check out all of the index, use <code class="literal">-a</code>.</p><p>NOTE! <code class="literal">git checkout-index</code> normally refuses to overwrite old files, so  if you have an old version of the tree already checked out, you will  need to use the "-f" flag (<span class="emphasis"><em>before</em></span> the "-a" flag or the filename) to  <span class="emphasis"><em>force</em></span> the checkout.</p><p>Finally, there are a few odds and ends which are not purely moving @@ -1632,7 +1632,7 @@  of a working directory, a "commit" represents that state in "time",  and explains how we got there.</p><p>You create a commit object by giving it the tree that describes the  state at the time of the commit, and a list of parents:</p><div class="literallayout"><p>$ git commit-tree &lt;tree&gt; -p &lt;parent&gt; [-p &lt;parent2&gt; ..]</p></div><p>and then giving the reason for the commit on stdin (either through -redirection from a pipe or file, or by just typing it at the tty).</p><p>git-commit-tree will return the name of the object that represents +redirection from a pipe or file, or by just typing it at the tty).</p><p><code class="literal">git commit-tree</code> will return the name of the object that represents  that commit, and you should save it away for later use. Normally,  you'd commit a new <code class="literal">HEAD</code> state, and while git doesn't care where you  save the note about that state, in practice we tend to just write the @@ -1676,7 +1676,7 @@  object:</p><div class="literallayout"><p>$ git cat-file -t &lt;objectname&gt;</p></div><p>shows the type of the object, and once you have the type (which is  usually implicit in where you find the object), you can use</p><div class="literallayout"><p>$ git cat-file blob|tree|commit|tag &lt;objectname&gt;</p></div><p>to show its contents. NOTE! Trees have binary content, and as a result  there is a special helper for showing that content, called -<code class="literal">git-ls-tree</code>, which turns the binary content into a more easily +<code class="literal">git ls-tree</code>, which turns the binary content into a more easily  readable form.</p><p>It's especially instructive to look at "commit" objects, since those  tend to be small and fairly self-explanatory. In particular, if you  follow the convention of having the top commit name in <code class="literal">.git/HEAD</code>, @@ -1710,11 +1710,11 @@  100644 263414f423d0e4d70dae8fe53fa34614ff3e2860 1       hello.c<br>  100644 06fa6a24256dc7e560efa5687fa84b51f0263c3a 2       hello.c<br>  100644 cc44c73eb783565da5831b4d820c962954019b69 3       hello.c</p></div><p>Each line of the <code class="literal">git ls-files —unmerged</code> output begins with -the blob mode bits, blob SHA1, <span class="emphasis"><em>stage number</em></span>, and the +the blob mode bits, blob SHA-1, <span class="emphasis"><em>stage number</em></span>, and the  filename. The <span class="emphasis"><em>stage number</em></span> is git's way to say which tree it  came from: stage 1 corresponds to <code class="literal">$orig</code> tree, stage 2 <code class="literal">HEAD</code>  tree, and stage3 <code class="literal">$target</code> tree.</p><p>Earlier we said that trivial merges are done inside -<code class="literal">git-read-tree -m</code>. For example, if the file did not change +<code class="literal">git read-tree -m</code>. For example, if the file did not change  from <code class="literal">$orig</code> to <code class="literal">HEAD</code> nor <code class="literal">$target</code>, or if the file changed  from <code class="literal">$orig</code> to <code class="literal">HEAD</code> and <code class="literal">$orig</code> to <code class="literal">$target</code> the same way,  obviously the final outcome is what is in <code class="literal">HEAD</code>. What the @@ -1729,31 +1729,31 @@  with conflict markers if there are conflicts. After verifying  the merge result makes sense, you can tell git what the final  merge result for this file is by:</p><div class="literallayout"><p>$ mv -f hello.c~2 hello.c<br> -$ git update-index hello.c</p></div><p>When a path is in the "unmerged" state, running <code class="literal">git-update-index</code> for +$ git update-index hello.c</p></div><p>When a path is in the "unmerged" state, running <code class="literal">git update-index</code> for  that path tells git to mark the path resolved.</p><p>The above is the description of a git merge at the lowest level,  to help you understand what conceptually happens under the hood. -In practice, nobody, not even git itself, runs <code class="literal">git-cat-file</code> three times -for this. There is a <code class="literal">git-merge-index</code> program that extracts the -stages to temporary files and calls a "merge" script on it:</p><div class="literallayout"><p>$ git merge-index git-merge-one-file hello.c</p></div><p>and that is what higher level <code class="literal">git-merge -s resolve</code> is implemented with.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="hacking-git"></a>Chapter 10. Hacking git</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></div><p>This chapter covers internal details of the git implementation which +In practice, nobody, not even git itself, runs <code class="literal">git cat-file</code> three times +for this. There is a <code class="literal">git merge-index</code> program that extracts the +stages to temporary files and calls a "merge" script on it:</p><div class="literallayout"><p>$ git merge-index git-merge-one-file hello.c</p></div><p>and that is what higher level <code class="literal">git merge -s resolve</code> is implemented with.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="hacking-git"></a>Chapter 10. Hacking git</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></div><p>This chapter covers internal details of the git implementation which  probably only git developers need to understand.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="object-details"></a>Object storage format</h2></div></div></div><p>All objects have a statically determined "type" which identifies the  format of the object (i.e. how it is used, and how it can refer to other  objects). There are currently four different object types: "blob",  "tree", "commit", and "tag".</p><p>Regardless of object type, all objects share the following  characteristics: they are all deflated with zlib, and have a header  that not only specifies their type, but also provides size information -about the data in the object. It's worth noting that the SHA1 hash +about the data in the object. It's worth noting that the SHA-1 hash  that is used to name the object is the hash of the original data  plus this header, so <code class="literal">sha1sum</code> <span class="emphasis"><em>file</em></span> does not match the object name  for <span class="emphasis"><em>file</em></span>.  (Historical note: in the dawn of the age of git the hash -was the sha1 of the <span class="emphasis"><em>compressed</em></span> object.)</p><p>As a result, the general consistency of an object can always be tested +was the SHA-1 of the <span class="emphasis"><em>compressed</em></span> object.)</p><p>As a result, the general consistency of an object can always be tested  independently of the contents or the type of the object: all objects can  be validated by verifying that (a) their hashes match the content of the  file and (b) the object successfully inflates to a stream of bytes that  forms a sequence of &lt;ascii type without space&gt; + &lt;space&gt; + &lt;ascii decimal  size&gt; + &lt;byte\0&gt; + &lt;binary object data&gt;.</p><p>The structured objects can further have their structure and  connectivity to other objects verified. This is generally done with -the <code class="literal">git-fsck</code> program, which generates a full dependency graph +the <code class="literal">git fsck</code> program, which generates a full dependency graph  of all objects, and verifies their internal consistency (in addition  to just verifying their superficial consistency through the hash).</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="birdview-on-the-source-code"></a>A birds-eye view of Git's source code</h2></div></div></div><p>It is not always easy for new developers to find their way through Git's  source code. This section gives you a little guidance to show where to @@ -1780,15 +1780,15 @@  All of these are handled in <code class="literal">sha1_name.c</code>. Just have a quick look at  the function <code class="literal">get_sha1()</code>. A lot of the special handling is done by  functions like <code class="literal">get_sha1_basic()</code> or the likes.</p><p>This is just to get you into the groove for the most libified part of Git: -the revision walker.</p><p>Basically, the initial version of <code class="literal">git-log</code> was a shell script:</p><div class="literallayout"><p>$ git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | \<br> -        LESS=-S ${PAGER:-less}</p></div><p>What does this mean?</p><p><code class="literal">git-rev-list</code> is the original version of the revision walker, which +the revision walker.</p><p>Basically, the initial version of <code class="literal">git log</code> was a shell script:</p><div class="literallayout"><p>$ git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | \<br> +        LESS=-S ${PAGER:-less}</p></div><p>What does this mean?</p><p><code class="literal">git rev-list</code> is the original version of the revision walker, which  <span class="emphasis"><em>always</em></span> printed a list of revisions to stdout. It is still functional,  and needs to, since most new Git programs start out as scripts using -<code class="literal">git-rev-list</code>.</p><p><code class="literal">git-rev-parse</code> is not as important any more; it was only used to filter out +<code class="literal">git rev-list</code>.</p><p><code class="literal">git rev-parse</code> is not as important any more; it was only used to filter out  options that were relevant for the different plumbing commands that were -called by the script.</p><p>Most of what <code class="literal">git-rev-list</code> did is contained in <code class="literal">revision.c</code> and +called by the script.</p><p>Most of what <code class="literal">git rev-list</code> did is contained in <code class="literal">revision.c</code> and  <code class="literal">revision.h</code>. It wraps the options in a struct named <code class="literal">rev_info</code>, which -controls how and what revisions are walked, and more.</p><p>The original job of <code class="literal">git-rev-parse</code> is now taken by the function +controls how and what revisions are walked, and more.</p><p>The original job of <code class="literal">git rev-parse</code> is now taken by the function  <code class="literal">setup_revisions()</code>, which parses the revisions and the common command line  options for the revision walker. This information is stored in the struct  <code class="literal">rev_info</code> for later consumption. You can do your own command line option @@ -1797,7 +1797,7 @@  commits one by one with the function <code class="literal">get_revision()</code>.</p><p>If you are interested in more details of the revision walking process,  just have a look at the first implementation of <code class="literal">cmd_log()</code>; call  <code class="literal">git show v1.3.0~155^2~4</code> and scroll down to that function (note that you -no longer need to call <code class="literal">setup_pager()</code> directly).</p><p>Nowadays, <code class="literal">git-log</code> is a builtin, which means that it is <span class="emphasis"><em>contained</em></span> in the +no longer need to call <code class="literal">setup_pager()</code> directly).</p><p>Nowadays, <code class="literal">git log</code> is a builtin, which means that it is <span class="emphasis"><em>contained</em></span> in the  command <code class="literal">git</code>. The source side of a builtin is</p><div class="itemizedlist"><ul type="disc"><li>  a function called <code class="literal">cmd_&lt;bla&gt;</code>, typically defined in <code class="literal">builtin-&lt;bla&gt;.c</code>,  and declared in <code class="literal">builtin.h</code>, @@ -1809,12 +1809,12 @@  example, <code class="literal">cmd_whatchanged()</code> and <code class="literal">cmd_log()</code> both reside in <code class="literal">builtin-log.c</code>,  since they share quite a bit of code. In that case, the commands which are  <span class="emphasis"><em>not</em></span> named like the <code class="literal">.c</code> file in which they live have to be listed in -<code class="literal">BUILT_INS</code> in the <code class="literal">Makefile</code>.</p><p><code class="literal">git-log</code> looks more complicated in C than it does in the original script, +<code class="literal">BUILT_INS</code> in the <code class="literal">Makefile</code>.</p><p><code class="literal">git log</code> looks more complicated in C than it does in the original script,  but that allows for a much greater flexibility and performance.</p><p>Here again it is a good point to take a pause.</p><p>Lesson three is: study the code. Really, it is the best way to learn about  the organization of Git (after you know the basic concepts).</p><p>So, think about something which you are interested in, say, "how can I  access a blob just knowing the object name of it?". The first step is to  find a Git command with which you can do it. In this example, it is either -<code class="literal">git-show</code> or <code class="literal">git-cat-file</code>.</p><p>For the sake of clarity, let's stay with <code class="literal">git-cat-file</code>, because it</p><div class="itemizedlist"><ul type="disc"><li> +<code class="literal">git show</code> or <code class="literal">git cat-file</code>.</p><p>For the sake of clarity, let's stay with <code class="literal">git cat-file</code>, because it</p><div class="itemizedlist"><ul type="disc"><li>  is plumbing, and  </li><li>  was around even in the initial commit (it literally went only through @@ -1823,7 +1823,7 @@  </li></ul></div><p>So, look into <code class="literal">builtin-cat-file.c</code>, search for <code class="literal">cmd_cat_file()</code> and look what  it does.</p><div class="literallayout"><p>        git_config(git_default_config);<br>          if (argc != 3)<br> -                usage("git-cat-file [-t|-s|-e|-p|&lt;type&gt;] &lt;sha1&gt;");<br> +                usage("git cat-file [-t|-s|-e|-p|&lt;type&gt;] &lt;sha1&gt;");<br>          if (get_sha1(argv[2], sha1))<br>                  die("Not a valid object name %s", argv[2]);</p></div><p>Let's skip over the obvious details; the only really interesting part  here is the call to <code class="literal">get_sha1()</code>. It tries to interpret <code class="literal">argv[2]</code> as an @@ -1845,8 +1845,8 @@  works, find the source code for it (something like <code class="literal">git grep  read_object_with | grep ":[a-z]"</code> in the git repository), and read  the source.</p><p>To find out how the result can be used, just read on in <code class="literal">cmd_cat_file()</code>:</p><div class="literallayout"><p>        write_or_die(1, buf, size);</p></div><p>Sometimes, you do not know where to look for a feature. In many such cases, -it helps to search through the output of <code class="literal">git log</code>, and then <code class="literal">git-show</code> the -corresponding commit.</p><p>Example: If you know that there was some test case for <code class="literal">git-bundle</code>, but +it helps to search through the output of <code class="literal">git log</code>, and then <code class="literal">git show</code> the +corresponding commit.</p><p>Example: If you know that there was some test case for <code class="literal">git bundle</code>, but  do not remember where it was (yes, you <span class="emphasis"><em>could</em></span> <code class="literal">git grep bundle t/</code>, but that  does not illustrate the point!):</p><div class="literallayout"><p>$ git log --no-merges t/</p></div><p>In the pager (<code class="literal">less</code>), just search for "bundle", go a few lines back,  and see that it is in commit 18449ab0… Now just copy this object name, @@ -2454,7 +2454,7 @@  Whenever possible, section headings should clearly describe the task  they explain how to do, in language that requires no more knowledge  than necessary: for example, "importing patches into a project" rather - than "the git-am command" + than "the <code class="literal">git am</code> command"  </li></ul></div><p>Think about how to create a clear chapter dependency graph that will  allow people to get to important topics without necessarily reading  everything in between.</p><p>Scan Documentation/ for other stuff left out; in particular:</p><div class="itemizedlist"><ul type="disc"><li> 
diff --git a/user-manual.txt b/user-manual.txt index e33b29b..dbbeb7e 100644 --- a/user-manual.txt +++ b/user-manual.txt 
@@ -188,7 +188,7 @@  did, and why.    Every commit has a 40-hexdigit id, sometimes called the "object name" or the -"SHA1 id", shown on the first line of the "git-show" output. You can usually +"SHA-1 id", shown on the first line of the "git show" output. You can usually  refer to a commit by a shorter name, such as a tag or a branch name, but this  longer name can also be useful. Most importantly, it is a globally unique  name for this commit: so if you tell somebody else the object name (for @@ -307,7 +307,7 @@  Examining an old version without creating a new branch  ------------------------------------------------------   -The git-checkout command normally expects a branch head, but will also +The `git checkout` command normally expects a branch head, but will also  accept an arbitrary commit; for example, you can check out the commit  referenced by a tag:   @@ -320,7 +320,7 @@  HEAD is now at 427abfa... Linux v2.6.17  ------------------------------------------------   -The HEAD then refers to the SHA1 of the commit instead of to a branch, +The HEAD then refers to the SHA-1 of the commit instead of to a branch,  and git branch shows that you are no longer on a branch:    ------------------------------------------------ @@ -400,7 +400,7 @@  REVISIONS" section of linkgit:git-rev-parse[1].    [[Updating-a-repository-With-git-fetch]] -Updating a repository with git-fetch +Updating a repository with git fetch  ------------------------------------    Eventually the developer cloned from will do additional work in her @@ -427,7 +427,7 @@  -------------------------------------------------    New remote-tracking branches will be stored under the shorthand name -that you gave "git-remote add", in this case linux-nfs: +that you gave "git remote add", in this case linux-nfs:    -------------------------------------------------  $ git branch -r @@ -516,7 +516,7 @@    to return you to the branch you were on before.   -Note that the version which git-bisect checks out for you at each +Note that the version which `git bisect` checks out for you at each  point is just a suggestion, and you're free to try a different  version if you think it would be a good idea. For example,  occasionally you may land on a commit that broke something unrelated; @@ -592,11 +592,11 @@  commits:    Merges (to be discussed later), as well as operations such as -git-reset, which change the currently checked-out commit, generally +`git reset`, which change the currently checked-out commit, generally  set ORIG_HEAD to the value HEAD had before the current operation.   -The git-fetch operation always stores the head of the last fetched -branch in FETCH_HEAD. For example, if you run git fetch without +The `git fetch` operation always stores the head of the last fetched +branch in FETCH_HEAD. For example, if you run `git fetch` without  specifying a local branch as the target of the operation    ------------------------------------------------- @@ -739,7 +739,7 @@  -------------------------------------------------    Alternatively, you may often see this sort of thing done with the -lower-level command linkgit:git-rev-list[1], which just lists the SHA1's +lower-level command linkgit:git-rev-list[1], which just lists the SHA-1's  of all the given commits:    ------------------------------------------------- @@ -1073,9 +1073,9 @@    shows the difference between the working tree and the index file.   -Note that "git-add" always adds just the current contents of a file +Note that "git add" always adds just the current contents of a file  to the index; further changes to the same file will be ignored unless -you run git-add on the file again. +you run `git add` on the file again.    When you're ready, just run   @@ -1136,7 +1136,7 @@  A project will often generate files that you do 'not' want to track with git.  This typically includes files generated by a build process or temporary  backup files made by your editor. Of course, 'not' tracking files with git -is just a matter of 'not' calling `git-add` on them. But it quickly becomes +is just a matter of 'not' calling `git add` on them. But it quickly becomes  annoying to have these untracked files lying around; e.g. they make  `git add .` practically useless, and they keep showing up in the output of  `git status`. @@ -1349,7 +1349,7 @@  -------------------------------------------------    the different stages of that file will be "collapsed", after which -git-diff will (by default) no longer show diffs for that file. +`git diff` will (by default) no longer show diffs for that file.    [[undoing-a-merge]]  Undoing a merge @@ -1446,7 +1446,7 @@    If the problematic commit is the most recent commit, and you have not  yet made that commit public, then you may just -<<undoing-a-merge,destroy it using git-reset>>. +<<undoing-a-merge,destroy it using `git reset`>>.    Alternatively, you  can edit the working directory and update the index to fix your @@ -1474,7 +1474,7 @@    In the process of undoing a previous bad change, you may find it  useful to check out an older version of a particular file using -linkgit:git-checkout[1]. We've used git-checkout before to switch +linkgit:git-checkout[1]. We've used `git checkout` before to switch  branches, but it has quite different behavior if it is given a path  name: the command   @@ -1542,7 +1542,7 @@  -------------------------------------------------    to recompress the archive. This can be very time-consuming, so -you may prefer to run git-gc when you are not doing other work. +you may prefer to run `git gc` when you are not doing other work.      [[ensuring-reliability]] @@ -1634,7 +1634,7 @@  suppose you delete a branch, then realize you need the history it  contained. The reflog is also deleted; however, if you have not yet  pruned the repository, then you may still be able to find the lost -commits in the dangling objects that git-fsck reports. See +commits in the dangling objects that `git fsck` reports. See  <<dangling-objects>> for the details.    ------------------------------------------------- @@ -1676,7 +1676,7 @@  ===============================    [[getting-updates-With-git-pull]] -Getting updates with git-pull +Getting updates with git pull  -----------------------------    After you clone a repository and make a few changes of your own, you @@ -1722,7 +1722,7 @@  <<fast-forwards,fast forward>>; instead, your branch will just be  updated to point to the latest commit from the upstream branch.)   -The git-pull command can also be given "." as the "remote" repository, +The `git pull` command can also be given "." as the "remote" repository,  in which case it just merges in a branch from the current repository; so  the commands   @@ -1795,7 +1795,7 @@  Another way to submit changes to a project is to tell the maintainer  of that project to pull the changes from your repository using  linkgit:git-pull[1]. In the section "<<getting-updates-With-git-pull, -Getting updates with git-pull>>" we described this as a way to get +Getting updates with `git pull`>>" we described this as a way to get  updates from the "main" repository, but it works just as well in the  other direction.   @@ -1847,7 +1847,7 @@  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    Assume your personal repository is in the directory ~/proj. We -first create a new clone of the repository and tell git-daemon that it +first create a new clone of the repository and tell `git daemon` that it  is meant to be public:    ------------------------------------------------- @@ -1878,10 +1878,10 @@  Otherwise, all you need to do is start linkgit:git-daemon[1]; it will  listen on port 9418. By default, it will allow access to any directory  that looks like a git directory and contains the magic file -git-daemon-export-ok. Passing some directory paths as git-daemon +git-daemon-export-ok. Passing some directory paths as `git daemon`  arguments will further restrict the exports to those paths.   -You can also run git-daemon as an inetd service; see the +You can also run `git daemon` as an inetd service; see the  linkgit:git-daemon[1] man page for details. (See especially the  examples section.)   @@ -1942,7 +1942,7 @@  $ git push ssh://yourserver.com/~you/proj.git master  -------------------------------------------------   -As with git-fetch, git-push will complain if this does not result in a +As with `git fetch`, `git push` will complain if this does not result in a  <<fast-forwards,fast forward>>; see the following section for details on  handling this case.   @@ -1952,7 +1952,7 @@  will not be updated by the push. This may lead to unexpected results if  the branch you push to is the currently checked-out branch!   -As with git-fetch, you may also set up configuration options to +As with `git fetch`, you may also set up configuration options to  save typing; so, for example, after    ------------------------------------------------- @@ -1988,13 +1988,13 @@    This can happen, for example, if you:   -	- use `git-reset --hard` to remove already-published commits, or -	- use `git-commit --amend` to replace already-published commits +	- use `git reset --hard` to remove already-published commits, or +	- use `git commit --amend` to replace already-published commits  (as in <<fixing-a-mistake-by-rewriting-history>>), or -	- use `git-rebase` to rebase any already-published commits (as +	- use `git rebase` to rebase any already-published commits (as  in <<using-git-rebase>>).   -You may force git-push to perform the update anyway by preceding the +You may force `git push` to perform the update anyway by preceding the  branch name with a plus sign:    ------------------------------------------------- @@ -2036,7 +2036,7 @@   	- Git's ability to quickly import and merge patches allows a  single maintainer to process incoming changes even at very - high rates. And when that becomes too much, git-pull provides + high rates. And when that becomes too much, `git pull` provides  an easy way for that maintainer to delegate this job to other  maintainers while still allowing optional review of incoming  changes. @@ -2404,7 +2404,7 @@  you are rewriting history.    [[using-git-rebase]] -Keeping a patch series up to date using git-rebase +Keeping a patch series up to date using git rebase  --------------------------------------------------    Suppose that you create a branch "mywork" on a remote-tracking branch @@ -2468,9 +2468,9 @@  ................................................    In the process, it may discover conflicts. In that case it will stop -and allow you to fix the conflicts; after fixing conflicts, use "git-add" +and allow you to fix the conflicts; after fixing conflicts, use `git add`  to update the index with those contents, and then, instead of -running git-commit, just run +running `git commit`, just run    -------------------------------------------------  $ git rebase --continue @@ -2508,7 +2508,7 @@  $ git tag bad mywork~5  -------------------------------------------------   -(Either gitk or git-log may be useful for finding the commit.) +(Either gitk or `git log` may be useful for finding the commit.)    Then check out that commit, edit it, and rebase the rest of the series  on top of it (note that we could check out the commit on a temporary @@ -2549,12 +2549,12 @@    and browse through the list of patches in the mywork branch using gitk,  applying them (possibly in a different order) to mywork-new using -cherry-pick, and possibly modifying them as you go using `commit --amend`. +cherry-pick, and possibly modifying them as you go using `git commit --amend`.  The linkgit:git-gui[1] command may also help as it allows you to  individually select diff hunks for inclusion in the index (by  right-clicking on the diff hunk and choosing "Stage Hunk for Commit").   -Another technique is to use git-format-patch to create a series of +Another technique is to use `git format-patch` to create a series of  patches, then reset the state to before the patches:    ------------------------------------------------- @@ -2662,7 +2662,7 @@  linkgit:git-bisect[1] identifies C as the culprit, how will you  figure out that the problem is due to this change in semantics?   -When the result of a git-bisect is a non-merge commit, you should +When the result of a `git bisect` is a non-merge commit, you should  normally be able to discover the problem by examining just that commit.  Developers can make this easy by breaking their changes into small  self-contained commits. That won't help in the case above, however, @@ -2725,7 +2725,7 @@  git fetch and fast-forwards  ---------------------------   -In the previous example, when updating an existing branch, "git-fetch" +In the previous example, when updating an existing branch, "git fetch"  checks to make sure that the most recent commit on the remote  branch is a descendant of the most recent commit on your copy of the  branch before updating your copy of the branch to point at the new @@ -2751,7 +2751,7 @@  o--o--o <-- new head of the branch  ................................................   -In this case, "git-fetch" will fail, and print out a warning. +In this case, "git fetch" will fail, and print out a warning.    In that case, you can still force git to update to the new head, as  described in the following section. However, note that in the @@ -2760,7 +2760,7 @@  them.    [[forcing-fetch]] -Forcing git-fetch to do non-fast-forward updates +Forcing git fetch to do non-fast-forward updates  ------------------------------------------------    If git fetch fails because the new head of a branch is not a @@ -2865,8 +2865,8 @@  We already saw in <<understanding-commits>> that all commits are stored  under a 40-digit "object name". In fact, all the information needed to  represent the history of a project is stored in objects with such names. -In each case the name is calculated by taking the SHA1 hash of the -contents of the object. The SHA1 hash is a cryptographic hash function. +In each case the name is calculated by taking the SHA-1 hash of the +contents of the object. The SHA-1 hash is a cryptographic hash function.  What that means to us is that it is impossible to find two different  objects with the same name. This has a number of advantages; among  others: @@ -2877,10 +2877,10 @@  same content stored in two repositories will always be stored under  the same name.  - Git can detect errors when it reads an object, by checking that the - object's name is still the SHA1 hash of its contents. + object's name is still the SHA-1 hash of its contents.    (See <<object-details>> for the details of the object formatting and -SHA1 calculation.) +SHA-1 calculation.)    There are four different types of objects: "blob", "tree", "commit", and  "tag". @@ -2926,9 +2926,9 @@    As you can see, a commit is defined by:   -- a tree: The SHA1 name of a tree object (as defined below), representing +- a tree: The SHA-1 name of a tree object (as defined below), representing  the contents of a directory at a certain point in time. -- parent(s): The SHA1 name of some number of commits which represent the +- parent(s): The SHA-1 name of some number of commits which represent the  immediately previous step(s) in the history of the project. The  example above has one parent; merge commits may have more than  one. A commit with no parents is called a "root" commit, and @@ -2977,13 +2977,13 @@  ------------------------------------------------    As you can see, a tree object contains a list of entries, each with a -mode, object type, SHA1 name, and name, sorted by name. It represents +mode, object type, SHA-1 name, and name, sorted by name. It represents  the contents of a single directory tree.    The object type may be a blob, representing the contents of a file, or  another tree, representing the contents of a subdirectory. Since trees -and blobs, like all other objects, are named by the SHA1 hash of their -contents, two trees have the same SHA1 name if and only if their +and blobs, like all other objects, are named by the SHA-1 hash of their +contents, two trees have the same SHA-1 name if and only if their  contents (including, recursively, the contents of all subdirectories)  are identical. This allows git to quickly determine the differences  between two related tree objects, since it can ignore any entries with @@ -3029,15 +3029,15 @@  Trust  ~~~~~   -If you receive the SHA1 name of a blob from one source, and its contents +If you receive the SHA-1 name of a blob from one source, and its contents  from another (possibly untrusted) source, you can still trust that those -contents are correct as long as the SHA1 name agrees. This is because -the SHA1 is designed so that it is infeasible to find different contents +contents are correct as long as the SHA-1 name agrees. This is because +the SHA-1 is designed so that it is infeasible to find different contents  that produce the same hash.   -Similarly, you need only trust the SHA1 name of a top-level tree object +Similarly, you need only trust the SHA-1 name of a top-level tree object  to trust the contents of the entire directory that it refers to, and if -you receive the SHA1 name of a commit from a trusted source, then you +you receive the SHA-1 name of a commit from a trusted source, then you  can easily verify the entire history of commits reachable through  parents of that commit, and all of those contents of the trees referred  to by those commits. @@ -3049,7 +3049,7 @@  commits tells others that they can trust the whole history.    In other words, you can easily validate a whole archive by just -sending out a single email that tells the people the name (SHA1 hash) +sending out a single email that tells the people the name (SHA-1 hash)  of the top commit, and digitally sign that email using something  like GPG/PGP.   @@ -3090,7 +3090,7 @@  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    Newly created objects are initially created in a file named after the -object's SHA1 hash (stored in .git/objects). +object's SHA-1 hash (stored in .git/objects).    Unfortunately this system becomes inefficient once a project has a  lot of objects. Try this on an old project: @@ -3131,7 +3131,7 @@    to remove any of the "loose" objects that are now contained in the  pack. This will also remove any unreferenced objects (which may be -created when, for example, you use "git-reset" to remove a commit). +created when, for example, you use "git reset" to remove a commit).  You can verify that the loose objects are gone by looking at the  .git/objects directory or by running   @@ -3160,7 +3160,7 @@  pointer itself just doesn't, since you replaced it with another one.    There are also other situations that cause dangling objects. For -example, a "dangling blob" may arise because you did a "git-add" of a +example, a "dangling blob" may arise because you did a "git add" of a  file, but then, before you actually committed it and made it part of the  bigger picture, you changed something else in that file and committed  that *updated* thing--the old state that you added originally ends up @@ -3210,7 +3210,7 @@  almost always the result of either being a half-way mergebase (the blob  will often even have the conflict markers from a merge in it, if you  have had conflicting merges that you fixed up by hand), or simply -because you interrupted a "git-fetch" with ^C or something like that, +because you interrupted a "git fetch" with ^C or something like that,  leaving _some_ of the new objects in the object database, but just  dangling and useless.   @@ -3225,9 +3225,9 @@  repository--it's kind of like doing a filesystem fsck recovery: you  don't want to do that while the filesystem is mounted.   -(The same is true of "git-fsck" itself, btw, but since -git-fsck never actually *changes* the repository, it just reports -on what it found, git-fsck itself is never "dangerous" to run. +(The same is true of "git fsck" itself, btw, but since +`git fsck` never actually *changes* the repository, it just reports +on what it found, `git fsck` itself is never 'dangerous' to run.  Running it while somebody is actually changing the repository can cause  confusing and scary messages, but it won't actually do anything bad. In  contrast, running "git prune" while somebody is actively changing the @@ -3297,7 +3297,7 @@  ------------------------------------------------    which will create and store a blob object with the contents of -somedirectory/myfile, and output the sha1 of that object. if you're +somedirectory/myfile, and output the SHA-1 of that object. if you're  extremely lucky it might be 4b9458b3786228369c63936db65827de3cc06200, in  which case you've guessed right, and the corruption is fixed!   @@ -3359,7 +3359,7 @@  -----------    The index is a binary file (generally kept in .git/index) containing a -sorted list of path names, each with permissions and the SHA1 of a blob +sorted list of path names, each with permissions and the SHA-1 of a blob  object; linkgit:git-ls-files[1] can show you the contents of the index:    ------------------------------------------------- @@ -3489,14 +3489,14 @@    NOTE: Do not use local URLs here if you plan to publish your superproject!   -See what files `git-submodule` created: +See what files `git submodule` created:    -------------------------------------------------  $ ls -a  . .. .git .gitmodules a b c d  -------------------------------------------------   -The `git-submodule add <repo> <path>` command does a couple of things: +The `git submodule add <repo> <path>` command does a couple of things:    - It clones the submodule from <repo> to the given <path> under the  current directory and by default checks out the master branch. @@ -3542,7 +3542,7 @@  $ git submodule init  -------------------------------------------------   -Now use `git-submodule update` to clone the repositories and check out the +Now use `git submodule update` to clone the repositories and check out the  commits specified in the superproject:    ------------------------------------------------- @@ -3552,8 +3552,8 @@  . .. .git a.txt  -------------------------------------------------   -One major difference between `git-submodule update` and `git-submodule add` is -that `git-submodule update` checks out a specific commit, rather than the tip +One major difference between `git submodule update` and `git submodule add` is +that `git submodule update` checks out a specific commit, rather than the tip  of a branch. It's like checking out a tag: the head is detached, so you're not  working on a branch.   @@ -3754,7 +3754,7 @@  index. Normal operation is just    ------------------------------------------------- -$ git read-tree <sha1 of tree> +$ git read-tree <SHA-1 of tree>  -------------------------------------------------    and your index file will now be equivalent to the tree that you saved @@ -3769,7 +3769,7 @@  files. This is not a very common operation, since normally you'd just  keep your files updated, and rather than write to your working  directory, you'd tell the index files about the changes in your -working directory (i.e. `git-update-index`). +working directory (i.e. `git update-index`).    However, if you decide to jump to a new version, or check out somebody  else's version, or just restore a previous tree, you'd populate your @@ -3782,7 +3782,7 @@    or, if you want to check out all of the index, use `-a`.   -NOTE! git-checkout-index normally refuses to overwrite old files, so +NOTE! `git checkout-index` normally refuses to overwrite old files, so  if you have an old version of the tree already checked out, you will  need to use the "-f" flag ('before' the "-a" flag or the filename) to  'force' the checkout. @@ -3820,7 +3820,7 @@  and then giving the reason for the commit on stdin (either through  redirection from a pipe or file, or by just typing it at the tty).   -git-commit-tree will return the name of the object that represents +`git commit-tree` will return the name of the object that represents  that commit, and you should save it away for later use. Normally,  you'd commit a new `HEAD` state, and while git doesn't care where you  save the note about that state, in practice we tend to just write the @@ -3889,7 +3889,7 @@    to show its contents. NOTE! Trees have binary content, and as a result  there is a special helper for showing that content, called -`git-ls-tree`, which turns the binary content into a more easily +`git ls-tree`, which turns the binary content into a more easily  readable form.    It's especially instructive to look at "commit" objects, since those @@ -3978,13 +3978,13 @@  ------------------------------------------------    Each line of the `git ls-files --unmerged` output begins with -the blob mode bits, blob SHA1, 'stage number', and the +the blob mode bits, blob SHA-1, 'stage number', and the  filename. The 'stage number' is git's way to say which tree it  came from: stage 1 corresponds to `$orig` tree, stage 2 `HEAD`  tree, and stage3 `$target` tree.    Earlier we said that trivial merges are done inside -`git-read-tree -m`. For example, if the file did not change +`git read-tree -m`. For example, if the file did not change  from `$orig` to `HEAD` nor `$target`, or if the file changed  from `$orig` to `HEAD` and `$orig` to `$target` the same way,  obviously the final outcome is what is in `HEAD`. What the @@ -4011,20 +4011,20 @@  $ git update-index hello.c  -------------------------------------------------   -When a path is in the "unmerged" state, running `git-update-index` for +When a path is in the "unmerged" state, running `git update-index` for  that path tells git to mark the path resolved.    The above is the description of a git merge at the lowest level,  to help you understand what conceptually happens under the hood. -In practice, nobody, not even git itself, runs `git-cat-file` three times -for this. There is a `git-merge-index` program that extracts the +In practice, nobody, not even git itself, runs `git cat-file` three times +for this. There is a `git merge-index` program that extracts the  stages to temporary files and calls a "merge" script on it:    -------------------------------------------------  $ git merge-index git-merge-one-file hello.c  -------------------------------------------------   -and that is what higher level `git-merge -s resolve` is implemented with. +and that is what higher level `git merge -s resolve` is implemented with.    [[hacking-git]]  Hacking git @@ -4045,12 +4045,12 @@  Regardless of object type, all objects share the following  characteristics: they are all deflated with zlib, and have a header  that not only specifies their type, but also provides size information -about the data in the object. It's worth noting that the SHA1 hash +about the data in the object. It's worth noting that the SHA-1 hash  that is used to name the object is the hash of the original data  plus this header, so `sha1sum` 'file' does not match the object name  for 'file'.  (Historical note: in the dawn of the age of git the hash -was the sha1 of the 'compressed' object.) +was the SHA-1 of the 'compressed' object.)    As a result, the general consistency of an object can always be tested  independently of the contents or the type of the object: all objects can @@ -4061,7 +4061,7 @@    The structured objects can further have their structure and  connectivity to other objects verified. This is generally done with -the `git-fsck` program, which generates a full dependency graph +the `git fsck` program, which generates a full dependency graph  of all objects, and verifies their internal consistency (in addition  to just verifying their superficial consistency through the hash).   @@ -4120,7 +4120,7 @@  This is just to get you into the groove for the most libified part of Git:  the revision walker.   -Basically, the initial version of `git-log` was a shell script: +Basically, the initial version of `git log` was a shell script:    ----------------------------------------------------------------  $ git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | \ @@ -4129,20 +4129,20 @@    What does this mean?   -`git-rev-list` is the original version of the revision walker, which +`git rev-list` is the original version of the revision walker, which  _always_ printed a list of revisions to stdout. It is still functional,  and needs to, since most new Git programs start out as scripts using -`git-rev-list`. +`git rev-list`.   -`git-rev-parse` is not as important any more; it was only used to filter out +`git rev-parse` is not as important any more; it was only used to filter out  options that were relevant for the different plumbing commands that were  called by the script.   -Most of what `git-rev-list` did is contained in `revision.c` and +Most of what `git rev-list` did is contained in `revision.c` and  `revision.h`. It wraps the options in a struct named `rev_info`, which  controls how and what revisions are walked, and more.   -The original job of `git-rev-parse` is now taken by the function +The original job of `git rev-parse` is now taken by the function  `setup_revisions()`, which parses the revisions and the common command line  options for the revision walker. This information is stored in the struct  `rev_info` for later consumption. You can do your own command line option @@ -4155,7 +4155,7 @@  `git show v1.3.0{tilde}155^2{tilde}4` and scroll down to that function (note that you  no longer need to call `setup_pager()` directly).   -Nowadays, `git-log` is a builtin, which means that it is _contained_ in the +Nowadays, `git log` is a builtin, which means that it is _contained_ in the  command `git`. The source side of a builtin is    - a function called `cmd_<bla>`, typically defined in `builtin-<bla>.c`, @@ -4171,7 +4171,7 @@  _not_ named like the `.c` file in which they live have to be listed in  `BUILT_INS` in the `Makefile`.   -`git-log` looks more complicated in C than it does in the original script, +`git log` looks more complicated in C than it does in the original script,  but that allows for a much greater flexibility and performance.    Here again it is a good point to take a pause. @@ -4182,9 +4182,9 @@  So, think about something which you are interested in, say, "how can I  access a blob just knowing the object name of it?". The first step is to  find a Git command with which you can do it. In this example, it is either -`git-show` or `git-cat-file`. +`git show` or `git cat-file`.   -For the sake of clarity, let's stay with `git-cat-file`, because it +For the sake of clarity, let's stay with `git cat-file`, because it    - is plumbing, and   @@ -4198,7 +4198,7 @@  ------------------------------------------------------------------  git_config(git_default_config);  if (argc != 3) - usage("git-cat-file [-t|-s|-e|-p|<type>] <sha1>"); +	usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>");  if (get_sha1(argv[2], sha1))  die("Not a valid object name %s", argv[2]);  ------------------------------------------------------------------ @@ -4243,10 +4243,10 @@  -----------------------------------    Sometimes, you do not know where to look for a feature. In many such cases, -it helps to search through the output of `git log`, and then `git-show` the +it helps to search through the output of `git log`, and then `git show` the  corresponding commit.   -Example: If you know that there was some test case for `git-bundle`, but +Example: If you know that there was some test case for `git bundle`, but  do not remember where it was (yes, you _could_ `git grep bundle t/`, but that  does not illustrate the point!):   @@ -4530,7 +4530,7 @@  - Whenever possible, section headings should clearly describe the task  they explain how to do, in language that requires no more knowledge  than necessary: for example, "importing patches into a project" rather - than "the git-am command" + than "the `git am` command"    Think about how to create a clear chapter dependency graph that will  allow people to get to important topics without necessarily reading